summaryrefslogtreecommitdiff
path: root/ext/js/data/json-schema.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/data/json-schema.js')
-rw-r--r--ext/js/data/json-schema.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/js/data/json-schema.js b/ext/js/data/json-schema.js
index 08414164..ee58976e 100644
--- a/ext/js/data/json-schema.js
+++ b/ext/js/data/json-schema.js
@@ -1343,12 +1343,18 @@ class JsonSchemaProxyHandler {
* @returns {?number}
*/
_getArrayIndex(property) {
- if (typeof property === 'string' && this._numberPattern.test(property)) {
- return Number.parseInt(property, 10);
- } else if (typeof property === 'number' && Math.floor(property) === property && property >= 0) {
- return property;
- } else {
- return null;
+ switch (typeof property) {
+ case 'string':
+ if (this._numberPattern.test(property)) {
+ return Number.parseInt(property, 10);
+ }
+ break;
+ case 'number':
+ if (Math.floor(property) === property && property >= 0) {
+ return property;
+ }
+ break;
}
+ return null;
}
}