mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Add baseSortedUniqBy.
This commit is contained in:
19
lodash.js
19
lodash.js
@@ -2586,15 +2586,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
|
* The base implementation of `_.sortedUniq`.
|
||||||
* support for callback shorthands.
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to inspect.
|
||||||
|
* @returns {Array} Returns the new duplicate free array.
|
||||||
|
*/
|
||||||
|
function baseSortedUniq(array) {
|
||||||
|
return baseSortedUniqBy(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.sortedUniqBy` without support for callback
|
||||||
|
* shorthands.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to inspect.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {Function} [iteratee] The function invoked per iteration.
|
* @param {Function} [iteratee] The function invoked per iteration.
|
||||||
* @returns {Array} Returns the new duplicate free array.
|
* @returns {Array} Returns the new duplicate free array.
|
||||||
*/
|
*/
|
||||||
function baseSortedUniq(array, iteratee) {
|
function baseSortedUniqBy(array, iteratee) {
|
||||||
var length = array.length;
|
var length = array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
@@ -5167,7 +5178,7 @@
|
|||||||
*/
|
*/
|
||||||
function sortedUniqBy(array, iteratee) {
|
function sortedUniqBy(array, iteratee) {
|
||||||
return (array && array.length)
|
return (array && array.length)
|
||||||
? baseSortedUniq(array, getIteratee(iteratee))
|
? baseSortedUniqBy(array, getIteratee(iteratee))
|
||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user