mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Rebuild docs and files.
Former-commit-id: 59596707224acabb767b87078d69363c293eec2d
This commit is contained in:
89
dist/lodash.compat.js
vendored
89
dist/lodash.compat.js
vendored
@@ -192,6 +192,7 @@
|
||||
getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
|
||||
hasOwnProperty = objectProto.hasOwnProperty,
|
||||
push = arrayProto.push,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
setImmediate = context.setImmediate,
|
||||
setTimeout = context.setTimeout,
|
||||
toString = objectProto.toString;
|
||||
@@ -347,6 +348,14 @@
|
||||
*/
|
||||
support.argsClass = isArguments(arguments);
|
||||
|
||||
/**
|
||||
* Detect if `name` or `message` properties of `Error.prototype` are
|
||||
* enumerable by default. (IE < 9, Safari < 5.1)
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
|
||||
|
||||
/**
|
||||
* Detect if `prototype` properties are enumerable by default.
|
||||
*
|
||||
@@ -358,7 +367,7 @@
|
||||
* @memberOf _.support
|
||||
* @type Boolean
|
||||
*/
|
||||
support.enumPrototypes = ctor.propertyIsEnumerable('prototype');
|
||||
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
|
||||
|
||||
/**
|
||||
* Detect if `Function#bind` exists and is inferred to be fast (all but V8).
|
||||
@@ -524,50 +533,53 @@
|
||||
}
|
||||
__p += '\n while (++index < length) {\n ' +
|
||||
(obj.loop) +
|
||||
'\n }\n}\nelse { ';
|
||||
';\n }\n}\nelse { ';
|
||||
} else if (support.nonEnumArgs) {
|
||||
__p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' +
|
||||
(obj.loop) +
|
||||
'\n }\n } else { ';
|
||||
';\n }\n } else { ';
|
||||
}
|
||||
|
||||
if (support.enumPrototypes) {
|
||||
__p += '\n var skipProto = typeof iterable == \'function\';\n ';
|
||||
}
|
||||
|
||||
if (support.enumErrorProps || support.nonEnumShadows) {
|
||||
__p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ';
|
||||
}
|
||||
|
||||
var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); }
|
||||
|
||||
if (obj.useHas && obj.useKeys) {
|
||||
__p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n ';
|
||||
if (support.enumPrototypes) {
|
||||
__p += 'if (!(skipProto && index == \'prototype\')) {\n ';
|
||||
}
|
||||
__p +=
|
||||
(obj.loop);
|
||||
if (support.enumPrototypes) {
|
||||
__p += '}\n';
|
||||
}
|
||||
__p += ' } ';
|
||||
} else {
|
||||
__p += '\n for (index in iterable) {';
|
||||
if (support.enumPrototypes || obj.useHas) {
|
||||
__p += '\n if (';
|
||||
if (support.enumPrototypes) {
|
||||
__p += '!(skipProto && index == \'prototype\')';
|
||||
} if (support.enumPrototypes && obj.useHas) {
|
||||
__p += ' && ';
|
||||
} if (obj.useHas) {
|
||||
__p += 'hasOwnProperty.call(iterable, index)';
|
||||
}
|
||||
__p += ') { ';
|
||||
__p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n';
|
||||
if (conditions.length) {
|
||||
__p += ' if (' +
|
||||
((__t = ( conditions.join(' && ') )) == null ? '' : __t) +
|
||||
') {\n ';
|
||||
}
|
||||
__p +=
|
||||
(obj.loop) +
|
||||
'; ';
|
||||
if (support.enumPrototypes || obj.useHas) {
|
||||
if (conditions.length) {
|
||||
__p += '\n }';
|
||||
}
|
||||
__p += '\n } ';
|
||||
} else {
|
||||
__p += '\n for (index in iterable) {\n';
|
||||
if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) {
|
||||
__p += ' if (' +
|
||||
((__t = ( conditions.join(' && ') )) == null ? '' : __t) +
|
||||
') {\n ';
|
||||
}
|
||||
__p +=
|
||||
(obj.loop) +
|
||||
'; ';
|
||||
if (conditions.length) {
|
||||
__p += '\n }';
|
||||
}
|
||||
__p += '\n } ';
|
||||
if (support.nonEnumShadows) {
|
||||
__p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n proto = ctor && ctor.prototype,\n isProto = iterable === proto,\n nonEnum = nonEnumProps[objectClass];\n\n if (isProto) {\n var className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[iterable === (ctorByClass[className] && ctorByClass[className].prototype) ? className : objectClass];\n }\n ';
|
||||
__p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ';
|
||||
for (k = 0; k < 7; k++) {
|
||||
__p += '\n index = \'' +
|
||||
(obj.shadowedProps[k]) +
|
||||
@@ -577,7 +589,7 @@
|
||||
}
|
||||
__p += ') {\n ' +
|
||||
(obj.loop) +
|
||||
'\n } ';
|
||||
';\n } ';
|
||||
}
|
||||
__p += '\n } ';
|
||||
}
|
||||
@@ -796,15 +808,15 @@
|
||||
// create the function factory
|
||||
var factory = Function(
|
||||
'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' +
|
||||
'isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, ' +
|
||||
'nonEnumProps, stringClass, stringProto, toString',
|
||||
'isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' +
|
||||
'stringClass, stringProto, toString',
|
||||
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
|
||||
);
|
||||
// return the compiled function
|
||||
return factory(
|
||||
ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments,
|
||||
isArray, isString, keys, lodash, objectClass, objectProto, objectTypes,
|
||||
nonEnumProps, stringClass, stringProto, toString
|
||||
isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps,
|
||||
stringClass, stringProto, toString
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1161,7 +1173,7 @@
|
||||
|
||||
// allows working with "Collections" methods without using their `callback`
|
||||
// argument, `index|key`, for this method's `callback`
|
||||
if (typeof deep == 'function') {
|
||||
if (typeof deep != 'boolean' && deep != null) {
|
||||
thisArg = callback;
|
||||
callback = deep;
|
||||
deep = false;
|
||||
@@ -3512,7 +3524,7 @@
|
||||
// juggle arguments
|
||||
if (typeof isShallow != 'boolean' && isShallow != null) {
|
||||
thisArg = callback;
|
||||
callback = isShallow;
|
||||
callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined;
|
||||
isShallow = false;
|
||||
}
|
||||
if (callback != null) {
|
||||
@@ -4073,7 +4085,7 @@
|
||||
// juggle arguments
|
||||
if (typeof isSorted != 'boolean' && isSorted != null) {
|
||||
thisArg = callback;
|
||||
callback = isSorted;
|
||||
callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined;
|
||||
isSorted = false;
|
||||
}
|
||||
// init value cache for large arrays
|
||||
@@ -4944,8 +4956,13 @@
|
||||
if (max == null) {
|
||||
max = min;
|
||||
min = 0;
|
||||
} else {
|
||||
max = +max || 0;
|
||||
}
|
||||
return min + floor(nativeRandom() * ((+max || 0) - min + 1));
|
||||
var rand = nativeRandom();
|
||||
return (min % 1 || max % 1)
|
||||
? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max)
|
||||
: min + floor(rand * (max - min + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user