COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220221806/https://github.com/lodash/lodash/blob/master/negate.js
Permalink
Cannot retrieve contributors at this time
28 lines (27 sloc)
688 Bytes
/**
* Creates a function that negates the result of the predicate `func`. The
* `func` predicate is invoked with the `this` binding and arguments of the
* created function.
*
* @since 3.0.0
* @category Function
* @param {Function } predicate The predicate to negate.
* @returns {Function } Returns the new negated function.
* @example
*
* function isEven(n) {
* return n % 2 == 0
* }
*
* filter([1, 2, 3, 4, 5, 6], negate(isEven))
* // => [1, 3, 5]
*/
function negate ( predicate ) {
if ( typeof predicate !== 'function' ) {
throw new TypeError ( 'Expected a function' )
}
return function ( ...args ) {
return !predicate . apply ( this , args )
}
}
export default negate
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.