This method is like `uniq` except that it accepts `iteratee` which is invoked for each element in `array` to generate the criterion by which uniqueness is computed. The order of result values is determined by the order they occur in the array. The iteratee is invoked with one argument: (value).
uniqBy([2.1, 1.2, 2.3], Math.floor)
// => [2.1, 1.2]
Name | Type | Attribute | Description |
---|---|---|---|
array | The array to inspect. | ||
iteratee | The iteratee invoked per element. |
{ "comment": "/**\r\n * This method is like `uniq` except that it accepts `iteratee` which is\r\n * invoked for each element in `array` to generate the criterion by which\r\n * uniqueness is computed. The order of result values is determined by the\r\n * order they occur in the array. The iteratee is invoked with one argument:\r\n * (value).\r\n *\r\n * @since 4.0.0\r\n * @category Array\r\n * @param {Array} array The array to inspect.\r\n * @param {Function} iteratee The iteratee invoked per element.\r\n * @returns {Array} Returns the new duplicate free array.\r\n * @see uniq, uniqWith\r\n * @example\r\n *\r\n * uniqBy([2.1, 1.2, 2.3], Math.floor)\r\n * // => [2.1, 1.2]\r\n */", "meta": { "range": [ 690, 812 ], "filename": "uniqBy.js", "lineno": 21, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100011230", "name": "uniqBy", "type": "FunctionDeclaration", "paramnames": [ "array", "iteratee" ] } }, "description": "This method is like `uniq` except that it accepts `iteratee` which is\rinvoked for each element in `array` to generate the criterion by which\runiqueness is computed. The order of result values is determined by the\rorder they occur in the array. The iteratee is invoked with one argument:\r(value).", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Array", "value": "Array" } ], "params": [ { "type": { "names": [ "Array" ] }, "description": "The array to inspect.", "name": "array" }, { "type": { "names": [ "function" ] }, "description": "The iteratee invoked per element.", "name": "iteratee" } ], "returns": [ { "type": { "names": [ "Array" ] }, "description": "Returns the new duplicate free array." } ], "see": [ "uniq, uniqWith" ], "examples": [ "uniqBy([2.1, 1.2, 2.3], Math.floor)\r// => [2.1, 1.2]" ], "name": "uniqBy", "longname": "uniqBy", "kind": "function", "scope": "global", "___id": "T000002R001019", "___s": true, "filepath": "uniqBy.js" }