Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
688 bytes
|
Line | |
---|
1 | var baseUniq = require('./_baseUniq');
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Creates a duplicate-free version of an array, using
|
---|
5 | * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
---|
6 | * for equality comparisons, in which only the first occurrence of each element
|
---|
7 | * is kept. The order of result values is determined by the order they occur
|
---|
8 | * in the array.
|
---|
9 | *
|
---|
10 | * @static
|
---|
11 | * @memberOf _
|
---|
12 | * @since 0.1.0
|
---|
13 | * @category Array
|
---|
14 | * @param {Array} array The array to inspect.
|
---|
15 | * @returns {Array} Returns the new duplicate free array.
|
---|
16 | * @example
|
---|
17 | *
|
---|
18 | * _.uniq([2, 1, 2]);
|
---|
19 | * // => [2, 1]
|
---|
20 | */
|
---|
21 | function uniq(array) {
|
---|
22 | return (array && array.length) ? baseUniq(array) : [];
|
---|
23 | }
|
---|
24 |
|
---|
25 | module.exports = uniq;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.