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:
parent
1fd1c9c58a
commit
41a166fb0e
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user