From 6f76645f4cf0005ddb1022406fdf259a5117ce26 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 28 Feb 2021 13:33:33 -0500 Subject: Use a Set instead of an array (#1463) --- ext/js/display/display-generator.js | 6 +++--- 1 file 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; } } -- cgit v1.2.3