aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display/display-generator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-28 13:33:33 -0500
committerGitHub <noreply@github.com>2021-02-28 13:33:33 -0500
commit6f76645f4cf0005ddb1022406fdf259a5117ce26 (patch)
tree20352bc282d79149f908ab4fee283365c4c1885b /ext/js/display/display-generator.js
parent445f87ebdb01badd5fd62a44bb165e23351e10c6 (diff)
Use a Set instead of an array (#1463)
Diffstat (limited to 'ext/js/display/display-generator.js')
-rw-r--r--ext/js/display/display-generator.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index 91dc0862..1d824507 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -724,15 +724,15 @@ class DisplayGenerator {
_getPitchAccentCategories(pitches) {
if (pitches.length === 0) { return null; }
- const categories = [];
+ const categories = new Set();
for (const {reading, pitches: pitches2} of pitches) {
for (const {position} of pitches2) {
const category = this._japaneseUtil.getPitchCategory(reading, position, false);
if (category !== null) {
- categories.push(category);
+ categories.add(category);
}
}
}
- return categories.length > 0 ? categories.join(' ') : null;
+ return categories.size > 0 ? [...categories].join(' ') : null;
}
}