mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Rebuild dist.
This commit is contained in:
302
dist/lodash.underscore.js
vendored
302
dist/lodash.underscore.js
vendored
@@ -222,7 +222,7 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Used for native method references */
|
||||
var arrayRef = Array.prototype,
|
||||
var arrayProto = Array.prototype,
|
||||
objectProto = Object.prototype;
|
||||
|
||||
/** Used to restore the original `_` reference in `_.noConflict` */
|
||||
@@ -249,9 +249,9 @@
|
||||
floor = Math.floor,
|
||||
fnToString = Function.prototype.toString,
|
||||
hasOwnProperty = objectProto.hasOwnProperty,
|
||||
push = arrayRef.push,
|
||||
push = arrayProto.push,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
splice = arrayRef.splice;
|
||||
splice = arrayProto.splice;
|
||||
|
||||
/* Native method shortcuts for methods with the same name as other `lodash` methods */
|
||||
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
|
||||
@@ -470,6 +470,31 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.assign` without support for argument juggling,
|
||||
* multiple sources, and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The destination object.
|
||||
* @param {Object} source The source object.
|
||||
* @param {Function} [callback] The function to customize assigning values.
|
||||
* @returns {Object} Returns the destination object.
|
||||
*/
|
||||
function baseAssign(object, source, callback) {
|
||||
if (!object) {
|
||||
return object;
|
||||
}
|
||||
var index = -1,
|
||||
props = keys(source),
|
||||
length = props.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
object[key] = callback ? callback(object[key], source[key], key, object, source) : source[key];
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.create` without support for assigning
|
||||
* properties to the created object.
|
||||
@@ -498,7 +523,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.createCallback` without support for creating
|
||||
* "_.pluck" or "_.where" style callbacks.
|
||||
* "_.pluck" and "_.where" style callbacks.
|
||||
*
|
||||
* @private
|
||||
* @param {*} [func=identity] The value to convert to a callback.
|
||||
@@ -555,11 +580,11 @@
|
||||
key = func;
|
||||
|
||||
function bound() {
|
||||
var index = -1,
|
||||
length = arguments.length,
|
||||
var length = arguments.length,
|
||||
index = length,
|
||||
args = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
while (index--) {
|
||||
args[index] = arguments[index];
|
||||
}
|
||||
if (partialArgs) {
|
||||
@@ -605,7 +630,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forEach` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
@@ -631,7 +656,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forEachRight` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
@@ -655,8 +680,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`
|
||||
* without support for callback shorthands or `this` binding which iterates
|
||||
* The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
|
||||
* without support for callback shorthands and `this` binding, which iterates
|
||||
* over `collection` using the provided `eachFunc`.
|
||||
*
|
||||
* @private
|
||||
@@ -681,7 +706,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.flatten` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
@@ -770,7 +795,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forIn` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
@@ -783,7 +808,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forOwn` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
@@ -796,7 +821,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forOwnRight` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
@@ -833,7 +858,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isEqual`, without support for `thisArg`
|
||||
* binding, that allows partial "_.where" style comparisons.
|
||||
* binding, which allows partial "_.where" style comparisons.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to compare to `other`.
|
||||
@@ -956,8 +981,66 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.random` without argument juggling or support
|
||||
* for returning floating-point numbers.
|
||||
* The base implementation of `_.invoke` which requires additional arguments
|
||||
* be provided as an array of arguments rather than individually.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function|string} methodName The name of the method to invoke or
|
||||
* the function invoked per iteration.
|
||||
* @param {Array} [args] The arguments to invoke the method with.
|
||||
* @returns {Array} Returns the array of results.
|
||||
*/
|
||||
function baseInvoke(collection, methodName, args) {
|
||||
var index = -1,
|
||||
isFunc = typeof methodName == 'function',
|
||||
length = collection && collection.length,
|
||||
result = Array(length < 0 ? 0 : length >>> 0);
|
||||
|
||||
baseEach(collection, function(value) {
|
||||
var func = isFunc ? methodName : (value != null && value[methodName]);
|
||||
result[++index] = func ? func.apply(value, args) : undefined;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.pick` without support for `this` binding
|
||||
* and individual property name arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The source object.
|
||||
* @param {Function|string[]} predicate The function called per iteration or
|
||||
* property names to pick.
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
function basePick(object, predicate) {
|
||||
var result = {};
|
||||
|
||||
if (typeof predicate == 'function') {
|
||||
baseForIn(object, function(value, key, object) {
|
||||
if (predicate(value, key, object)) {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
var index = -1,
|
||||
props = predicate,
|
||||
length = props.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
if (key in object) {
|
||||
result[key] = object[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.random` without support for argument juggling
|
||||
* and returning floating-point numbers.
|
||||
*
|
||||
* @private
|
||||
* @param {number} min The minimum possible value.
|
||||
@@ -970,7 +1053,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.uniq` without support for callback shorthands
|
||||
* or `this` binding.
|
||||
* and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to process.
|
||||
@@ -1030,6 +1113,32 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a function from `source` using the `varNames` and `varValues`
|
||||
* pairs to import free variables into the compiled function. If `sourceURL`
|
||||
* is provided it will be used as the sourceURL for the compiled function.
|
||||
*
|
||||
* @private
|
||||
* @param {string} source The source to compile.
|
||||
* @param {Array} varNames An array of free variable names.
|
||||
* @param {Array} varValues An array of free variable values.
|
||||
* @param {string} [sourceURL=''] The sourceURL of the source.
|
||||
* @returns {Function} Returns the compiled function.
|
||||
*/
|
||||
function compileFunction(source, varNames, varValues, sourceURL) {
|
||||
sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : '';
|
||||
try {
|
||||
// provide the compiled function's source by its `toString` method or
|
||||
// the `source` property as a convenience for inlining compiled templates
|
||||
var result = Function(varNames, 'return ' + source + sourceURL).apply(undefined, varValues);
|
||||
result.source = source;
|
||||
} catch(e) {
|
||||
e.source = source;
|
||||
throw e;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array that is the composition of partially applied arguments,
|
||||
* placeholders, and provided arguments into a single array of arguments.
|
||||
@@ -1064,7 +1173,7 @@
|
||||
* Creates a function that aggregates a collection, creating an accumulator
|
||||
* object composed from the results of running each element in the collection
|
||||
* through a callback. The given setter function sets the keys and values of
|
||||
* the accumulator object. If `initializer` is provided will be used to
|
||||
* the accumulator object. If `initializer` is provided it will be used to
|
||||
* initialize the accumulator object.
|
||||
*
|
||||
* @private
|
||||
@@ -1642,7 +1751,7 @@
|
||||
var index = -1,
|
||||
length = array ? array.length : 0;
|
||||
|
||||
start = typeof start == 'undefined' ? 0 : (+start || 0);
|
||||
start = start == null ? 0 : (+start || 0);
|
||||
if (start < 0) {
|
||||
start = nativeMax(length + start, 0);
|
||||
} else if (start > length) {
|
||||
@@ -2036,8 +2145,8 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Checks if a given value is present in a collection using strict equality
|
||||
* for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
|
||||
* Checks if `value` is present in `collection` using strict equality for
|
||||
* comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
|
||||
* offset from the end of the collection.
|
||||
*
|
||||
* @static
|
||||
@@ -2456,7 +2565,7 @@
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function|string} methodName The name of the method to invoke or
|
||||
* the function invoked per iteration.
|
||||
* @param {...*} [args] Arguments to invoke the method with.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Array} Returns the array of results.
|
||||
* @example
|
||||
*
|
||||
@@ -2467,17 +2576,7 @@
|
||||
* // => [['1', '2', '3'], ['4', '5', '6']]
|
||||
*/
|
||||
function invoke(collection, methodName) {
|
||||
var args = slice(arguments, 2),
|
||||
index = -1,
|
||||
isFunc = typeof methodName == 'function',
|
||||
length = collection && collection.length,
|
||||
result = Array(length < 0 ? 0 : length >>> 0);
|
||||
|
||||
baseEach(collection, function(value) {
|
||||
var func = isFunc ? methodName : (value != null && value[methodName]);
|
||||
result[++index] = func ? func.apply(value, args) : undefined;
|
||||
});
|
||||
return result;
|
||||
return baseInvoke(collection, methodName, slice(arguments, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3214,7 +3313,7 @@
|
||||
* @category Functions
|
||||
* @param {Function} func The function to bind.
|
||||
* @param {*} [thisArg] The `this` binding of `func`.
|
||||
* @param {...*} [args] Arguments to be partially applied.
|
||||
* @param {...*} [args] The arguments to be partially applied.
|
||||
* @returns {Function} Returns the new bound function.
|
||||
* @example
|
||||
*
|
||||
@@ -3244,8 +3343,8 @@
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
* @param {Object} object The object to bind and assign the bound methods to.
|
||||
* @param {...string} [methodNames] The object method names to bind, specified
|
||||
* as individual method names or arrays of method names.
|
||||
* @param {...(string|string[])} [methodNames] The object method names to bind,
|
||||
* specified as individual method names or arrays of method names.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
@@ -3259,12 +3358,26 @@
|
||||
* // => logs 'clicked docs', when the button is clicked
|
||||
*/
|
||||
function bindAll(object) {
|
||||
var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),
|
||||
index = -1,
|
||||
length = funcs.length;
|
||||
return baseBindAll(object, arguments.length > 1
|
||||
? baseFlatten(arguments, true, false, 1)
|
||||
: functions(object));
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.bindAll` without support for individual
|
||||
* method name arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to bind and assign the bound methods to.
|
||||
* @param {string[]} methodNames The object method names to bind.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseBindAll(object, methodNames) {
|
||||
var index = -1,
|
||||
length = methodNames.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = funcs[index];
|
||||
var key = methodNames[index];
|
||||
object[key] = createWrapper(object[key], BIND_FLAG, null, object);
|
||||
}
|
||||
return object;
|
||||
@@ -3469,7 +3582,7 @@
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
* @param {Function} func The function to defer.
|
||||
* @param {...*} [args] Arguments to invoke the function with.
|
||||
* @param {...*} [args] The arguments to invoke the function with.
|
||||
* @returns {number} Returns the timer id.
|
||||
* @example
|
||||
*
|
||||
@@ -3493,7 +3606,7 @@
|
||||
* @category Functions
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay execution.
|
||||
* @param {...*} [args] Arguments to invoke the function with.
|
||||
* @param {...*} [args] The arguments to invoke the function with.
|
||||
* @returns {number} Returns the timer id.
|
||||
* @example
|
||||
*
|
||||
@@ -3636,7 +3749,7 @@
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
* @param {Function} func The function to partially apply arguments to.
|
||||
* @param {...*} [args] Arguments to be partially applied.
|
||||
* @param {...*} [args] The arguments to be partially applied.
|
||||
* @returns {Function} Returns the new partially applied function.
|
||||
* @example
|
||||
*
|
||||
@@ -3731,8 +3844,8 @@
|
||||
* Assigns own enumerable properties of source object(s) to the destination
|
||||
* object. Subsequent sources will overwrite property assignments of previous
|
||||
* sources. If a callback is provided it will be executed to produce the
|
||||
* assigned values. The callback is bound to `thisArg` and invoked with two
|
||||
* arguments; (objectValue, sourceValue).
|
||||
* assigned values. The callback is bound to `thisArg` and invoked with
|
||||
* five arguments; (objectValue, sourceValue, key, object, source).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -3755,20 +3868,20 @@
|
||||
* defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
|
||||
* // => { 'name': 'barney', 'employer': 'slate' }
|
||||
*/
|
||||
function assign(object, source, guard) {
|
||||
function assign(object) {
|
||||
if (!object) {
|
||||
return object;
|
||||
}
|
||||
var args = arguments,
|
||||
argsIndex = 0,
|
||||
argsLength = args.length,
|
||||
type = typeof guard;
|
||||
index = 0,
|
||||
length = args.length,
|
||||
type = typeof args[2];
|
||||
|
||||
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
|
||||
argsLength = 2;
|
||||
if ((type == 'number' || type == 'string') && args[3] && args[3][args[2]] === args[1]) {
|
||||
length = 2;
|
||||
}
|
||||
while (++argsIndex < argsLength) {
|
||||
source = args[argsIndex];
|
||||
while (++index < length) {
|
||||
var source = args[index];
|
||||
for (var key in source) {
|
||||
object[key] = source[key];
|
||||
}
|
||||
@@ -3781,7 +3894,7 @@
|
||||
* be cloned, otherwise they will be assigned by reference. If a callback
|
||||
* is provided it will be executed to produce the cloned values. If the
|
||||
* callback returns `undefined` cloning will be handled by the method instead.
|
||||
* The callback is bound to `thisArg` and invoked with one argument; (value).
|
||||
* The callback is bound to `thisArg` and invoked with two argument; (value, index|key).
|
||||
*
|
||||
* Note: This method is loosely based on the structured clone algorithm. Functions
|
||||
* and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
|
||||
@@ -3848,20 +3961,20 @@
|
||||
* _.defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
|
||||
* // => { 'name': 'barney', 'employer': 'slate' }
|
||||
*/
|
||||
function defaults(object, source, guard) {
|
||||
function defaults(object) {
|
||||
if (!object) {
|
||||
return object;
|
||||
}
|
||||
var args = arguments,
|
||||
argsIndex = 0,
|
||||
argsLength = args.length,
|
||||
type = typeof guard;
|
||||
index = 0,
|
||||
length = args.length,
|
||||
type = typeof args[2];
|
||||
|
||||
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
|
||||
argsLength = 2;
|
||||
if ((type == 'number' || type == 'string') && args[3] && args[3][args[2]] === args[1]) {
|
||||
length = 2;
|
||||
}
|
||||
while (++argsIndex < argsLength) {
|
||||
source = args[argsIndex];
|
||||
while (++index < length) {
|
||||
var source = args[index];
|
||||
for (var key in source) {
|
||||
if (typeof object[key] == 'undefined') {
|
||||
object[key] = source[key];
|
||||
@@ -4106,7 +4219,7 @@
|
||||
* equivalent. If a callback is provided it will be executed to compare
|
||||
* values. If the callback returns `undefined` comparisons will be handled
|
||||
* by the method instead. The callback is bound to `thisArg` and invoked
|
||||
* with two arguments; (value, other).
|
||||
* with three arguments; (value, other, key).
|
||||
*
|
||||
* Note: This method supports comparing arrays, booleans, `Date` objects,
|
||||
* numbers, `Object` objects, regexes, and strings. Functions and DOM nodes
|
||||
@@ -4194,7 +4307,9 @@
|
||||
* // => false
|
||||
*/
|
||||
function isFunction(value) {
|
||||
return typeof value == 'function';
|
||||
// avoid a Chakra bug in IE 11
|
||||
// https://github.com/jashkenas/underscore/issues/1621
|
||||
return typeof value == 'function' || false;
|
||||
}
|
||||
// fallback for older versions of Chrome and Safari
|
||||
if (isFunction(/x/)) {
|
||||
@@ -4207,6 +4322,8 @@
|
||||
* Checks if `value` is the language type of `Object`.
|
||||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* Note: See the [ES5 spec](http://es5.github.io/#x8) for more details.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
@@ -4224,9 +4341,7 @@
|
||||
* // => false
|
||||
*/
|
||||
function isObject(value) {
|
||||
// check if the value is the ECMAScript language type of `Object`
|
||||
// http://es5.github.io/#x8
|
||||
// and avoid a V8 bug
|
||||
// avoid a V8 bug in Chrome 19-20
|
||||
// https://code.google.com/p/v8/issues/detail?id=2291
|
||||
var type = typeof value;
|
||||
return type == 'function' || (value && type == 'object') || false;
|
||||
@@ -4456,13 +4571,16 @@
|
||||
* // => { 'name': 'fred' }
|
||||
*/
|
||||
function omit(object) {
|
||||
if (!isObject(object)) {
|
||||
return {};
|
||||
}
|
||||
var omitProps = baseFlatten(arguments, true, false, 1),
|
||||
length = omitProps.length;
|
||||
|
||||
while (length--) {
|
||||
omitProps[length] = String(omitProps[length]);
|
||||
}
|
||||
return pick(object, baseDifference(keysIn(object), omitProps));
|
||||
return basePick(object, baseDifference(keysIn(object), omitProps));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4520,18 +4638,9 @@
|
||||
* // => { 'name': 'fred' }
|
||||
*/
|
||||
function pick(object) {
|
||||
var index = -1,
|
||||
props = baseFlatten(arguments, true, false, 1),
|
||||
length = props.length,
|
||||
result = {};
|
||||
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
if (key in object) {
|
||||
result[key] = object[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return isObject(object)
|
||||
? basePick(object, baseFlatten(arguments, true, false, 1))
|
||||
: {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4612,7 +4721,7 @@
|
||||
* settings object is provided it will override `_.templateSettings` for the
|
||||
* template.
|
||||
*
|
||||
* Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging.
|
||||
* Note: In the development build, `_.template` utilizes sourceURLs for easier debugging.
|
||||
* See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||
* for more details.
|
||||
*
|
||||
@@ -4630,9 +4739,9 @@
|
||||
* @param {Object} [options] The options object.
|
||||
* @param {RegExp} [options.escape] The HTML "escape" delimiter.
|
||||
* @param {RegExp} [options.evaluate] The "evaluate" delimiter.
|
||||
* @param {Object} [options.imports] An object to import into the template as local variables.
|
||||
* @param {Object} [options.imports] An object to import into the template as free variables.
|
||||
* @param {RegExp} [options.interpolate] The "interpolate" delimiter.
|
||||
* @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source.
|
||||
* @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
|
||||
* @param {string} [options.variable] The data object variable name.
|
||||
* @returns {Function|string} Returns the interpolated string if a data object
|
||||
* is provided, else the compiled template function.
|
||||
@@ -4670,7 +4779,7 @@
|
||||
* _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });
|
||||
* // => '<li>fred</li><li>barney</li>'
|
||||
*
|
||||
* // using the `sourceURL` option to specify a custom `sourceURL` for the template
|
||||
* // using the `sourceURL` option to specify a custom sourceURL for the template
|
||||
* var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
|
||||
* compiled(data);
|
||||
* // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
|
||||
@@ -4734,17 +4843,8 @@
|
||||
source +
|
||||
'return __p\n}';
|
||||
|
||||
try {
|
||||
var result = Function('_', 'return ' + source)(_);
|
||||
} catch(e) {
|
||||
e.source = source;
|
||||
throw e;
|
||||
}
|
||||
if (data) {
|
||||
return result(data);
|
||||
}
|
||||
result.source = source;
|
||||
return result;
|
||||
var result = compileFunction(source, ['_'], [_]);
|
||||
return data ? result(data) : result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5173,7 +5273,7 @@
|
||||
* @returns {Array} Returns the array of results.
|
||||
* @example
|
||||
*
|
||||
* var diceRolls = _.times(3, _.partial(_.random, 1, 6));
|
||||
* var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
|
||||
* // => [3, 6, 4]
|
||||
*
|
||||
* _.times(3, function(n) { mage.castSpell(n); });
|
||||
@@ -5350,7 +5450,7 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// add functions to `lodash.prototype`
|
||||
mixin(assign({}, lodash));
|
||||
mixin(baseAssign({}, lodash));
|
||||
|
||||
/**
|
||||
* The semantic version number.
|
||||
@@ -5367,7 +5467,7 @@
|
||||
|
||||
// add `Array` mutator functions to the wrapper
|
||||
arrayEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
||||
var func = arrayRef[methodName];
|
||||
var func = arrayProto[methodName];
|
||||
lodash.prototype[methodName] = function() {
|
||||
var value = this.__wrapped__;
|
||||
func.apply(value, arguments);
|
||||
@@ -5383,7 +5483,7 @@
|
||||
|
||||
// add `Array` accessor functions to the wrapper
|
||||
arrayEach(['concat', 'join', 'slice'], function(methodName) {
|
||||
var func = arrayRef[methodName];
|
||||
var func = arrayProto[methodName];
|
||||
lodash.prototype[methodName] = function() {
|
||||
var value = this.__wrapped__,
|
||||
result = func.apply(value, arguments);
|
||||
|
||||
Reference in New Issue
Block a user