diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index f1e553465b0..07d0ceacbfb 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -66,19 +66,18 @@ function sorter(a, b) { } function arrayUnique(items) { - const hash = {}; - const out = []; - let i, ilen, item; + const set = new Set(); + let i, ilen; for (i = 0, ilen = items.length; i < ilen; ++i) { - item = items[i]; - if (!hash[item]) { - hash[item] = true; - out.push(item); - } + set.add(items[i]); + } + + if (set.size === ilen) { + return items; } - return out; + return [...set]; } /**