mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Update docs and builds.
Former-commit-id: 6bb15d3ad0d4d189ad5e27e1dd79d2a070a568b2
This commit is contained in:
34
dist/lodash.js
vendored
34
dist/lodash.js
vendored
@@ -18,9 +18,9 @@
|
||||
/** Detect free variable `module` */
|
||||
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
|
||||
|
||||
/** Detect free variable `global` and use it as `window` */
|
||||
/** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
|
||||
var freeGlobal = typeof global == 'object' && global;
|
||||
if (freeGlobal.global === freeGlobal) {
|
||||
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
||||
window = freeGlobal;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
/** Used internally to indicate various things */
|
||||
var indicatorObject = {};
|
||||
|
||||
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
|
||||
var keyPrefix = +new Date + '';
|
||||
|
||||
/** Used to match empty string literals in compiled template source */
|
||||
var reEmptyStringLeading = /\b__p \+= '';/g,
|
||||
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
||||
@@ -169,7 +172,7 @@
|
||||
toString = objectRef.toString;
|
||||
|
||||
/* Native method shortcuts for methods with the same name as other `lodash` methods */
|
||||
var nativeBind = reNative.test(nativeBind = slice.bind) && nativeBind,
|
||||
var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
|
||||
nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
|
||||
nativeIsFinite = context.isFinite,
|
||||
nativeIsNaN = context.isNaN,
|
||||
@@ -428,16 +431,14 @@
|
||||
index = fromIndex - 1;
|
||||
|
||||
while (++index < length) {
|
||||
// manually coerce `value` to a string because `hasOwnProperty`, in some
|
||||
// older versions of Firefox, coerces objects incorrectly
|
||||
var key = String(array[index]);
|
||||
(hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]);
|
||||
var key = keyPrefix + array[index];
|
||||
(cache[key] || (cache[key] = [])).push(array[index]);
|
||||
}
|
||||
}
|
||||
return function(value) {
|
||||
if (isLarge) {
|
||||
var key = String(value);
|
||||
return hasOwnProperty.call(cache, key) && indexOf(cache[key], value) > -1;
|
||||
var key = keyPrefix + value;
|
||||
return cache[key] && indexOf(cache[key], value) > -1;
|
||||
}
|
||||
return indexOf(array, value, fromIndex) > -1;
|
||||
}
|
||||
@@ -1821,9 +1822,10 @@
|
||||
? (isArray(value) ? value : [])
|
||||
: (isPlainObject(value) ? value : {});
|
||||
|
||||
var isShallow;
|
||||
if (callback) {
|
||||
result = callback(value, source);
|
||||
if (typeof result != 'undefined') {
|
||||
if ((isShallow = typeof result != 'undefined')) {
|
||||
value = result;
|
||||
}
|
||||
}
|
||||
@@ -1832,7 +1834,7 @@
|
||||
stackB.push(value);
|
||||
|
||||
// recursively merge objects and arrays (susceptible to call stack limits)
|
||||
if (!callback) {
|
||||
if (!isShallow) {
|
||||
value = merge(value, source, indicatorObject, callback, stackA, stackB);
|
||||
}
|
||||
}
|
||||
@@ -3411,8 +3413,8 @@
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (isLarge) {
|
||||
var key = String(value);
|
||||
var inited = hasOwnProperty.call(cache[0], key)
|
||||
var key = keyPrefix + value;
|
||||
var inited = cache[0][key]
|
||||
? !(seen = cache[0][key])
|
||||
: (seen = cache[0][key] = []);
|
||||
}
|
||||
@@ -3819,8 +3821,8 @@
|
||||
computed = callback ? callback(value, index, array) : value;
|
||||
|
||||
if (isLarge) {
|
||||
var key = String(computed);
|
||||
var inited = hasOwnProperty.call(cache, key)
|
||||
var key = keyPrefix + computed;
|
||||
var inited = cache[key]
|
||||
? !(seen = cache[key])
|
||||
: (seen = cache[key] = []);
|
||||
}
|
||||
@@ -4305,7 +4307,7 @@
|
||||
function memoize(func, resolver) {
|
||||
var cache = {};
|
||||
return function() {
|
||||
var key = String(resolver ? resolver.apply(this, arguments) : arguments[0]);
|
||||
var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
|
||||
return hasOwnProperty.call(cache, key)
|
||||
? cache[key]
|
||||
: (cache[key] = func.apply(this, arguments));
|
||||
|
||||
Reference in New Issue
Block a user