The opposite of `filter` this method returns the elements of `collection` that `predicate` does **not** return truthy for.
const users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false }
]
reject(users, ({ active }) => active)
// => objects for ['fred']
Name | Type | Attribute | Description |
---|---|---|---|
collection | The collection to iterate over. | ||
predicate | The function invoked per iteration. |
{ "comment": "/**\r\n * The opposite of `filter` this method returns the elements of `collection`\r\n * that `predicate` does **not** return truthy for.\r\n *\r\n * @since 0.1.0\r\n * @category Collection\r\n * @param {Array|Object} collection The collection to iterate over.\r\n * @param {Function} predicate The function invoked per iteration.\r\n * @returns {Array} Returns the new filtered array.\r\n * @see pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, filter\r\n * @example\r\n *\r\n * const users = [\r\n * { 'user': 'barney', 'active': true },\r\n * { 'user': 'fred', 'active': false }\r\n * ]\r\n *\r\n * reject(users, ({ active }) => active)\r\n * // => objects for ['fred']\r\n */", "meta": { "range": [ 798, 956 ], "filename": "reject.js", "lineno": 25, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100007614", "name": "reject", "type": "FunctionDeclaration", "paramnames": [ "collection", "predicate" ] }, "vars": { "func": "reject~func" } }, "description": "The opposite of `filter` this method returns the elements of `collection`\rthat `predicate` does **not** return truthy for.", "since": "0.1.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Collection", "value": "Collection" } ], "params": [ { "type": { "names": [ "Array", "Object" ] }, "description": "The collection to iterate over.", "name": "collection" }, { "type": { "names": [ "function" ] }, "description": "The function invoked per iteration.", "name": "predicate" } ], "returns": [ { "type": { "names": [ "Array" ] }, "description": "Returns the new filtered array." } ], "see": [ "pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, filter" ], "examples": [ "const users = [\r { 'user': 'barney', 'active': true },\r { 'user': 'fred', 'active': false }\r]\r\rreject(users, ({ active }) => active)\r// => objects for ['fred']" ], "name": "reject", "longname": "reject", "kind": "function", "scope": "global", "___id": "T000002R000696", "___s": true, "filepath": "reject.js" }