summaryrefslogtreecommitdiff
path: root/ext/bg/js/deinflector.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2020-02-24 21:31:14 -0800
committerAlex Yatskov <alex@foosoft.net>2020-02-24 21:31:14 -0800
commitd32f4def0eeed1599857bc04c973337a2a13dd8b (patch)
tree61149656f361dd2d9998d67d68249dc184b73fbb /ext/bg/js/deinflector.js
parent0c5b9b1fa1599cbf769d96cdebc226310f9dd8bc (diff)
parent706c3edcffb0078d71fd5b58775f16cf5fc1205b (diff)
Merge branch 'master' into testing
Diffstat (limited to 'ext/bg/js/deinflector.js')
-rw-r--r--ext/bg/js/deinflector.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/ext/bg/js/deinflector.js b/ext/bg/js/deinflector.js
index 33b2a8b3..e2ced965 100644
--- a/ext/bg/js/deinflector.js
+++ b/ext/bg/js/deinflector.js
@@ -76,17 +76,19 @@ class Deinflector {
const ruleTypes = Deinflector.ruleTypes;
let value = 0;
for (const rule of rules) {
- value |= ruleTypes[rule];
+ const ruleBits = ruleTypes.get(rule);
+ if (typeof ruleBits === 'undefined') { continue; }
+ value |= ruleBits;
}
return value;
}
}
-Deinflector.ruleTypes = {
- 'v1': 0b0000001, // Verb ichidan
- 'v5': 0b0000010, // Verb godan
- 'vs': 0b0000100, // Verb suru
- 'vk': 0b0001000, // Verb kuru
- 'adj-i': 0b0010000, // Adjective i
- 'iru': 0b0100000 // Intermediate -iru endings for progressive or perfect tense
-};
+Deinflector.ruleTypes = new Map([
+ ['v1', 0b0000001], // Verb ichidan
+ ['v5', 0b0000010], // Verb godan
+ ['vs', 0b0000100], // Verb suru
+ ['vk', 0b0001000], // Verb kuru
+ ['adj-i', 0b0010000], // Adjective i
+ ['iru', 0b0100000] // Intermediate -iru endings for progressive or perfect tense
+]);