aboutsummaryrefslogtreecommitdiff
path: root/ext/js/data
diff options
context:
space:
mode:
authorCashew <52880648+Scrub1492@users.noreply.github.com>2023-12-27 13:41:35 +0700
committerGitHub <noreply@github.com>2023-12-27 06:41:35 +0000
commit860374fdab25fce3161ee835be0e141a341b9b9b (patch)
tree9a2612f719a46f7af29899da916b62c7724fea7e /ext/js/data
parent0094ff7babab6839ccef4c82fa46b8aa4f14198f (diff)
switch updates (#459)
* switch updates * revert to if-else * revert to if-else * remove empty default
Diffstat (limited to 'ext/js/data')
-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;
}
}