mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Rebuild docs and files.
Former-commit-id: ae6f8f4117b7baab2a47e7c8302edc1fa8dfdb07
This commit is contained in:
50
dist/lodash.js
vendored
50
dist/lodash.js
vendored
@@ -124,7 +124,11 @@
|
||||
* @returns {Function} Returns the `lodash` function.
|
||||
*/
|
||||
function runInContext(context) {
|
||||
context = context ? _.defaults({}, context, _.pick(window, contextProps)) : window;
|
||||
// Avoid issues with some ES3 environments that attempt to use values, named
|
||||
// after built-in constructors like `Object`, for the creation of literals.
|
||||
// ES5 clears this up by stating that literals must use built-in constructors.
|
||||
// See http://es5.github.com/#x11.1.5.
|
||||
context = context ? _.defaults(window.Object(), context, _.pick(window, contextProps)) : window;
|
||||
|
||||
/** Native constructor references */
|
||||
var Array = context.Array,
|
||||
@@ -1021,10 +1025,10 @@
|
||||
callback = typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg, 1);
|
||||
result = callback(result);
|
||||
|
||||
var done = typeof result != 'undefined';
|
||||
if (!done) {
|
||||
result = value;
|
||||
if (typeof result != 'undefined') {
|
||||
return result;
|
||||
}
|
||||
result = value;
|
||||
}
|
||||
// inspect [[Class]]
|
||||
var isObj = isObject(result);
|
||||
@@ -1037,7 +1041,7 @@
|
||||
}
|
||||
// shallow clone
|
||||
if (!isObj || !deep) {
|
||||
return isObj && !done
|
||||
return isObj
|
||||
? (isArr ? slice(result) : assign({}, result))
|
||||
: result;
|
||||
}
|
||||
@@ -1045,14 +1049,14 @@
|
||||
switch (className) {
|
||||
case boolClass:
|
||||
case dateClass:
|
||||
return done ? result : new ctor(+result);
|
||||
return new ctor(+result);
|
||||
|
||||
case numberClass:
|
||||
case stringClass:
|
||||
return done ? result : new ctor(result);
|
||||
return new ctor(result);
|
||||
|
||||
case regexpClass:
|
||||
return done ? result : ctor(result.source, reFlags.exec(result));
|
||||
return ctor(result.source, reFlags.exec(result));
|
||||
}
|
||||
// check for circular references and return corresponding clone
|
||||
stackA || (stackA = []);
|
||||
@@ -1065,17 +1069,15 @@
|
||||
}
|
||||
}
|
||||
// init cloned object
|
||||
if (!done) {
|
||||
result = isArr ? ctor(result.length) : {};
|
||||
result = isArr ? ctor(result.length) : {};
|
||||
|
||||
// add array properties assigned by `RegExp#exec`
|
||||
if (isArr) {
|
||||
if (hasOwnProperty.call(value, 'index')) {
|
||||
result.index = value.index;
|
||||
}
|
||||
if (hasOwnProperty.call(value, 'input')) {
|
||||
result.input = value.input;
|
||||
}
|
||||
// add array properties assigned by `RegExp#exec`
|
||||
if (isArr) {
|
||||
if (hasOwnProperty.call(value, 'index')) {
|
||||
result.index = value.index;
|
||||
}
|
||||
if (hasOwnProperty.call(value, 'input')) {
|
||||
result.input = value.input;
|
||||
}
|
||||
}
|
||||
// add the source value to the stack of traversed objects
|
||||
@@ -1084,7 +1086,7 @@
|
||||
stackB.push(result);
|
||||
|
||||
// recursively populate clone (susceptible to call stack limits)
|
||||
(isArr ? forEach : forOwn)(done ? result : value, function(objValue, key) {
|
||||
(isArr ? forEach : forOwn)(value, function(objValue, key) {
|
||||
result[key] = clone(objValue, deep, callback, undefined, stackA, stackB);
|
||||
});
|
||||
|
||||
@@ -1092,10 +1094,10 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a deep clone of `value`. If a `callback` function is passed, it will
|
||||
* be executed to produce the cloned values. If `callback` returns the value it
|
||||
* was passed, cloning will be handled by the method instead. The `callback` is
|
||||
* bound to `thisArg` and invoked with one argument; (value).
|
||||
* Creates a deep clone of `value`. If a `callback` function is passed,
|
||||
* it will be executed to produce the cloned values. If `callback` returns
|
||||
* `undefined`, cloning will be handled by the method instead. The `callback`
|
||||
* is bound to `thisArg` and invoked with one argument; (value).
|
||||
*
|
||||
* Note: This function is loosely based on the structured clone algorithm. Functions
|
||||
* and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
|
||||
@@ -1126,7 +1128,7 @@
|
||||
* };
|
||||
*
|
||||
* var clone = _.cloneDeep(view, function(value) {
|
||||
* return _.isElement(value) ? value.cloneNode(true) : value;
|
||||
* return _.isElement(value) ? value.cloneNode(true) : undefined;
|
||||
* });
|
||||
*
|
||||
* clone.node == view.node;
|
||||
|
||||
Reference in New Issue
Block a user