javascript - Why isn't this lodash uniq isSorted not working? -
so, expect sort, isn't.
_.uniq(array, [issorted], [iteratee], [thisarg])
so
_.uniq([10,3,13,1,0,2], true);
i run that, , doesn't sort. i'd expect return: [0,1,2,3,10,13]
that's not issorted
parameter does.
[issorted] (boolean): specify array sorted. - https://lodash.com/docs#uniq
does not mean sort array if set true it's expecting sorted array.
providing true issorted performs faster search algorithm sorted arrays.
it's optimization in algorithm "creates duplicate-free version of array" lot faster if array sorted.
Comments
Post a Comment