1 var baseIteratee = require('./_baseIteratee'),
2 baseUniq = require('./_baseUniq');
5 * This method is like `_.uniq` except that it accepts `iteratee` which is
6 * invoked for each element in `array` to generate the criterion by which
7 * uniqueness is computed. The iteratee is invoked with one argument: (value).
12 * @param {Array} array The array to inspect.
13 * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
14 * @returns {Array} Returns the new duplicate free array.
17 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
20 * // The `_.property` iteratee shorthand.
21 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
22 * // => [{ 'x': 1 }, { 'x': 2 }]
24 function uniqBy(array, iteratee) {
25 return (array && array.length)
26 ? baseUniq(array, baseIteratee(iteratee))
30 module.exports = uniqBy;