为什么这个 lodash uniq isSorted 不起作用?

Why isn't this lodash uniq isSorted not working?

所以,我希望这会排序,但事实并非如此。

_.uniq(array, [isSorted], [iteratee], [thisArg])

所以

_.uniq([10,3,13,1,0,2], true);

我运行那个,它没有排序。我希望它 return: [0,1,2,3,10,13]

这不是 isSorted 参数的作用。

[isSorted] (boolean): Specify the array is sorted. - https://lodash.com/docs#uniq

并不意味着它也会为您对数组进行排序,但如果您将其设置为 true,那么它会期待一个已经排序的数组。

Providing true for isSorted performs a faster search algorithm for sorted arrays.

这是一个优化,因为如果数组已经排序,"Creates a duplicate-free version of an array" 的算法会快很多。