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/20201220222642/https://github.com/lodash/lodash/blob/master/uniqWith.js
Permalink
Cannot retrieve contributors at this time
29 lines (27 sloc)
968 Bytes
import baseUniq from './.internal/baseUniq.js'
/**
* This method is like `uniq` except that it accepts `comparator` which
* is invoked to compare elements of `array`. The order of result values is
* determined by the order they occur in the array. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @since 4.0.0
* @category Array
* @param {Array } array The array to inspect.
* @param {Function } [comparator] The comparator invoked per element.
* @returns {Array } Returns the new duplicate free array.
* @see uniq, uniqBy
* @example
*
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]
*
* uniqWith(objects, isEqual)
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
*/
function uniqWith ( array , comparator ) {
comparator = typeof comparator === 'function' ? comparator : undefined
return ( array != null && array . length )
? baseUniq ( array , undefined , comparator )
: [ ]
}
export default uniqWith
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.