mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Add more isIterateeCall guards.
This commit is contained in:
21
lodash.js
21
lodash.js
@@ -5475,12 +5475,11 @@
|
||||
* // => { 'user': 'fred', 'age': 40 };
|
||||
*/
|
||||
function max(collection, iteratee, thisArg) {
|
||||
var noIteratee = iteratee == null;
|
||||
if (!noIteratee && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
iteratee = null;
|
||||
noIteratee = true;
|
||||
}
|
||||
var isArr = noIteratee && isArray(collection),
|
||||
var noIteratee = iteratee == null,
|
||||
isArr = noIteratee && isArray(collection),
|
||||
isStr = !isArr && isString(collection);
|
||||
|
||||
if (noIteratee && !isStr) {
|
||||
@@ -5547,12 +5546,11 @@
|
||||
* // => { 'user': 'barney', 'age': 36 };
|
||||
*/
|
||||
function min(collection, iteratee, thisArg) {
|
||||
var noIteratee = iteratee == null;
|
||||
if (!noIteratee && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
iteratee = null;
|
||||
noIteratee = true;
|
||||
}
|
||||
var isArr = noIteratee && isArray(collection),
|
||||
var noIteratee = iteratee == null,
|
||||
isArr = noIteratee && isArray(collection),
|
||||
isStr = !isArr && isString(collection);
|
||||
|
||||
if (noIteratee && !isStr) {
|
||||
@@ -5942,8 +5940,9 @@
|
||||
* // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]
|
||||
*/
|
||||
function sortBy(collection, iteratee, thisArg) {
|
||||
iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee;
|
||||
|
||||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
iteratee = null;
|
||||
}
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0,
|
||||
multi = iteratee && isArray(iteratee),
|
||||
@@ -8819,7 +8818,7 @@
|
||||
// https://github.com/olado/doT
|
||||
var settings = lodash.templateSettings;
|
||||
|
||||
if (isIterateeCall(string, options, otherOptions)) {
|
||||
if (otherOptions && isIterateeCall(string, options, otherOptions)) {
|
||||
options = otherOptions = null;
|
||||
}
|
||||
string = String(string == null ? '' : string);
|
||||
|
||||
Reference in New Issue
Block a user