mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
adding alias 'unique' to point to 'uniq'
This commit is contained in:
@@ -302,7 +302,7 @@
|
|||||||
|
|
||||||
// Produce a duplicate-free version of the array. If the array has already
|
// Produce a duplicate-free version of the array. If the array has already
|
||||||
// been sorted, you have the option of using a faster algorithm.
|
// been sorted, you have the option of using a faster algorithm.
|
||||||
_.uniq = function(array, isSorted) {
|
_.uniq = _.unique = function(array, isSorted) {
|
||||||
return _.reduce(array, function(memo, el, i) {
|
return _.reduce(array, function(memo, el, i) {
|
||||||
if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) memo[memo.length] = el;
|
if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) memo[memo.length] = el;
|
||||||
return memo;
|
return memo;
|
||||||
|
|||||||
Reference in New Issue
Block a user