From 1b5e0235deb7c030cc6aa9e7135d013d260fcabb Mon Sep 17 00:00:00 2001 From: Shan He Date: Mon, 30 Aug 2021 10:36:37 -0700 Subject: [PATCH] fix for long processing time of data-utils::unique (#1592) Signed-off-by: Igor Dykhta Co-authored-by: Igor Dykhta --- src/utils/data-utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/data-utils.js b/src/utils/data-utils.js index bb15df8bcf..ab1bf0a675 100644 --- a/src/utils/data-utils.js +++ b/src/utils/data-utils.js @@ -38,12 +38,12 @@ const MIN_LONGITUDE = -180; */ export function unique(values) { const results = []; - values.forEach(v => { - if (!results.includes(v) && notNullorUndefined(v)) { + const uniqueSet = new Set(values); + uniqueSet.forEach(v => { + if (notNullorUndefined(v)) { results.push(v); } }); - return results; }