mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Add getIteratee to _.cond.
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -3070,8 +3070,8 @@
|
|||||||
* @returns {Array} Returns the new sorted array.
|
* @returns {Array} Returns the new sorted array.
|
||||||
*/
|
*/
|
||||||
function baseOrderBy(collection, iteratees, orders) {
|
function baseOrderBy(collection, iteratees, orders) {
|
||||||
var toIteratee = getIteratee(),
|
var index = -1,
|
||||||
index = -1;
|
toIteratee = getIteratee();
|
||||||
|
|
||||||
iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) {
|
iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) {
|
||||||
return toIteratee(iteratee);
|
return toIteratee(iteratee);
|
||||||
@@ -12835,13 +12835,15 @@
|
|||||||
*/
|
*/
|
||||||
function cond(pairs) {
|
function cond(pairs) {
|
||||||
var length = pairs ? pairs.length : 0,
|
var length = pairs ? pairs.length : 0,
|
||||||
index = length;
|
toIteratee = getIteratee();
|
||||||
|
|
||||||
while (index--) {
|
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
||||||
if (typeof pairs[index][0] != 'function' || typeof pairs[index][1] != 'function') {
|
if (typeof pair[1] != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
}
|
return [toIteratee(pair[0]), pair[1]];
|
||||||
|
});
|
||||||
|
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var index = -1;
|
var index = -1;
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user