1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Rework check in isValidShortKeyInternal() to being an early return

This commit is contained in:
cyantree - Christoph Schreiber 2020-07-03 11:42:18 +02:00
parent 1fd1c9c58a
commit 41a166fb0e

View File

@ -177,6 +177,11 @@ export class ShapeDefinition extends BasicSerializableObject {
*/
static isValidShortKeyInternal(key) {
const sourceLayers = key.split(":");
if (sourceLayers.length === 0 || sourceLayers.length > 4) {
return false;
}
let layers = [];
for (let i = 0; i < sourceLayers.length; ++i) {
const text = sourceLayers[i];
@ -222,10 +227,6 @@ export class ShapeDefinition extends BasicSerializableObject {
layers.push(quads);
}
if (layers.length === 0 || layers.length > 4) {
return false;
}
return true;
}