CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
uniqWith.js29 linesDownload Raw Back to lodash
1var baseUniq = require('./_baseUniq');2 3/**4 * This method is like `_.uniq` except that it accepts `comparator` which5 * is invoked to compare elements of `array`. The order of result values is6 * determined by the order they occur in the array.The comparator is invoked7 * with two arguments: (arrVal, othVal).8 *9 * @static10 * @memberOf _11 * @since 4.0.012 * @category Array13 * @param {Array} array The array to inspect.14 * @param {Function} [comparator] The comparator invoked per element.15 * @returns {Array} Returns the new duplicate free array.16 * @example17 *18 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];19 *20 * _.uniqWith(objects, _.isEqual);21 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]22 */23function uniqWith(array, comparator) {24  comparator = typeof comparator == 'function' ? comparator : undefined;25  return (array && array.length) ? baseUniq(array, undefined, comparator) : [];26}27 28module.exports = uniqWith;29 
basant307/AI_Governance_Project · CoolFace