CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
uniqBy.js32 linesDownload Raw Back to lodash
1var baseIteratee = require('./_baseIteratee'),2    baseUniq = require('./_baseUniq');3 4/**5 * This method is like `_.uniq` except that it accepts `iteratee` which is6 * invoked for each element in `array` to generate the criterion by which7 * uniqueness is computed. The order of result values is determined by the8 * order they occur in the array. The iteratee is invoked with one argument:9 * (value).10 *11 * @static12 * @memberOf _13 * @since 4.0.014 * @category Array15 * @param {Array} array The array to inspect.16 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.17 * @returns {Array} Returns the new duplicate free array.18 * @example19 *20 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);21 * // => [2.1, 1.2]22 *23 * // The `_.property` iteratee shorthand.24 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');25 * // => [{ 'x': 1 }, { 'x': 2 }]26 */27function uniqBy(array, iteratee) {28  return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];29}30 31module.exports = uniqBy;32 
basant307/AI_Governance_Project · CoolFace