Debian Codegraph @

node/lodash/uniq.js

raw
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;