summaryrefslogtreecommitdiff
path: root/ext/js/general/object-property-accessor.js
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/general/object-property-accessor.js
parent0094ff7babab6839ccef4c82fa46b8aa4f14198f (diff)
switch updates (#459)
* switch updates * revert to if-else * revert to if-else * remove empty default
Diffstat (limited to 'ext/js/general/object-property-accessor.js')
-rw-r--r--ext/js/general/object-property-accessor.js41
1 files changed, 25 insertions, 16 deletions
diff --git a/ext/js/general/object-property-accessor.js b/ext/js/general/object-property-accessor.js
index d818c9d1..b8d6ddc5 100644
--- a/ext/js/general/object-property-accessor.js
+++ b/ext/js/general/object-property-accessor.js
@@ -207,16 +207,21 @@ export class ObjectPropertyAccessor {
v === 0x5f // '_'
) {
value += c;
- } else if (v === 0x5b) { // '['
- pathArray.push(value);
- value = '';
- state = 'open-bracket';
- } else if (v === 0x2e) { // '.'
- pathArray.push(value);
- value = '';
- state = 'id-start';
} else {
- throw new Error(`Unexpected character: ${c}`);
+ switch (v) {
+ case 0x5b: // '['
+ pathArray.push(value);
+ value = '';
+ state = 'open-bracket';
+ break;
+ case 0x2e: // '.'
+ pathArray.push(value);
+ value = '';
+ state = 'id-start';
+ break;
+ default:
+ throw new Error(`Unexpected character: ${c}`);
+ }
}
break;
case 'open-bracket': // Open bracket
@@ -262,15 +267,19 @@ export class ObjectPropertyAccessor {
throw new Error(`Unexpected character: ${c}`);
}
break;
- case 'next': // Expecting . or [
- if (v === 0x5b) { // '['
- state = 'open-bracket';
- } else if (v === 0x2e) { // '.'
- state = 'id-start';
- } else {
- throw new Error(`Unexpected character: ${c}`);
+ case 'next': { // Expecting . or [
+ switch (v) {
+ case 0x5b: // '['
+ state = 'open-bracket';
+ break;
+ case 0x2e: // '.'
+ state = 'id-start';
+ break;
+ default:
+ throw new Error(`Unexpected character: ${c}`);
}
break;
+ }
}
}
switch (state) {