Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
698 bytes
|
Line | |
---|
1 | var baseIteratee = require('./_baseIteratee'),
|
---|
2 | baseSortedUniq = require('./_baseSortedUniq');
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * This method is like `_.uniqBy` except that it's designed and optimized
|
---|
6 | * for sorted arrays.
|
---|
7 | *
|
---|
8 | * @static
|
---|
9 | * @memberOf _
|
---|
10 | * @since 4.0.0
|
---|
11 | * @category Array
|
---|
12 | * @param {Array} array The array to inspect.
|
---|
13 | * @param {Function} [iteratee] The iteratee invoked per element.
|
---|
14 | * @returns {Array} Returns the new duplicate free array.
|
---|
15 | * @example
|
---|
16 | *
|
---|
17 | * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
|
---|
18 | * // => [1.1, 2.3]
|
---|
19 | */
|
---|
20 | function sortedUniqBy(array, iteratee) {
|
---|
21 | return (array && array.length)
|
---|
22 | ? baseSortedUniq(array, baseIteratee(iteratee, 2))
|
---|
23 | : [];
|
---|
24 | }
|
---|
25 |
|
---|
26 | module.exports = sortedUniqBy;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.