Creates a duplicate-free version of an array, using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.
uniq([2, 1, 2])
// => [2, 1]
Name | Type | Attribute | Description |
---|---|---|---|
array | The array to inspect. |
{ "comment": "/**\r\n * Creates a duplicate-free version of an array, using\r\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\r\n * for equality comparisons, in which only the first occurrence of each element\r\n * is kept. The order of result values is determined by the order they occur\r\n * in the array.\r\n *\r\n * @since 0.1.0\r\n * @category Array\r\n * @param {Array} array The array to inspect.\r\n * @returns {Array} Returns the new duplicate free array.\r\n * @see uniqBy, uniqWith\r\n * @example\r\n *\r\n * uniq([2, 1, 2])\r\n * // => [2, 1]\r\n */", "meta": { "range": [ 605, 705 ], "filename": "uniq.js", "lineno": 20, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100011206", "name": "uniq", "type": "FunctionDeclaration", "paramnames": [ "array" ] } }, "description": "Creates a duplicate-free version of an array, using\r[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\rfor equality comparisons, in which only the first occurrence of each element\ris kept. The order of result values is determined by the order they occur\rin the array.", "since": "0.1.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Array", "value": "Array" } ], "params": [ { "type": { "names": [ "Array" ] }, "description": "The array to inspect.", "name": "array" } ], "returns": [ { "type": { "names": [ "Array" ] }, "description": "Returns the new duplicate free array." } ], "see": [ "uniqBy, uniqWith" ], "examples": [ "uniq([2, 1, 2])\r// => [2, 1]" ], "name": "uniq", "longname": "uniq", "kind": "function", "scope": "global", "___id": "T000002R001017", "___s": true, "filepath": "uniq.js" }