mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Bump to v4.7.0.
This commit is contained in:
6
cond.js
6
cond.js
@@ -14,6 +14,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {Array} pairs The predicate-function pairs.
|
||||
* @returns {Function} Returns the new function.
|
||||
@@ -35,13 +36,14 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
* // => 'no match'
|
||||
*/
|
||||
function cond(pairs) {
|
||||
var length = pairs ? pairs.length : 0;
|
||||
var length = pairs ? pairs.length : 0,
|
||||
toIteratee = baseIteratee;
|
||||
|
||||
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
||||
if (typeof pair[1] != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
return [baseIteratee(pair[0]), pair[1]];
|
||||
return [toIteratee(pair[0]), pair[1]];
|
||||
});
|
||||
|
||||
return rest(function(args) {
|
||||
|
||||
Reference in New Issue
Block a user