vendor/assets/javascripts/lodash.compat.js in lodash-rails-3.10.0 vs vendor/assets/javascripts/lodash.compat.js in lodash-rails-3.10.1
- old
+ new
@@ -1,8 +1,8 @@
/**
* @license
- * lodash 3.10.0 (Custom Build) <https://lodash.com/>
+ * lodash 3.10.1 (Custom Build) <https://lodash.com/>
* Build: `lodash compat -o ./lodash.js`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
@@ -11,11 +11,11 @@
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** Used as the semantic version number. */
- var VERSION = '3.10.0';
+ var VERSION = '3.10.1';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_BOUND_FLAG = 4,
@@ -619,11 +619,11 @@
* for callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The function invoked per iteration.
- * @returns {Array} Returns the new duplicate-value-free array.
+ * @returns {Array} Returns the new duplicate free array.
*/
function sortedUniq(array, iteratee) {
var seen,
index = -1,
length = array.length,
@@ -1204,11 +1204,11 @@
iterLength = iteratees.length,
resIndex = 0,
takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
- return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
+ return baseWrapperValue(array, this.__actions__);
}
var result = [];
outer:
while (length-- && resIndex < takeCount) {
@@ -1924,11 +1924,11 @@
if (!length) {
return result;
}
var index = -1,
indexOf = getIndexOf(),
- isCommon = indexOf == baseIndexOf,
+ isCommon = indexOf === baseIndexOf,
cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
valuesLength = values.length;
if (cache) {
indexOf = cacheIndexOf;
@@ -2793,17 +2793,17 @@
* and `this` binding.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The function invoked per iteration.
- * @returns {Array} Returns the new duplicate-value-free array.
+ * @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee) {
var index = -1,
indexOf = getIndexOf(),
length = array.length,
- isCommon = indexOf == baseIndexOf,
+ isCommon = indexOf === baseIndexOf,
isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
seen = isLarge ? createCache() : null,
result = [];
if (seen) {
@@ -4008,11 +4008,11 @@
* @private
* @param {Function} func The function to query.
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
- var result = func.name,
+ var result = (func.name + ''),
array = realNames[result],
length = array ? array.length : 0;
while (length--) {
var data = array[length],
@@ -4279,15 +4279,16 @@
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
*/
function isLaziable(func) {
- var funcName = getFuncName(func);
- if (!(funcName in LazyWrapper.prototype)) {
+ var funcName = getFuncName(func),
+ other = lodash[funcName];
+
+ if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
return false;
}
- var other = lodash[funcName];
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
@@ -5031,11 +5032,11 @@
return array ? array[0] : undefined;
}
/**
* Flattens a nested array. If `isDeep` is `true` the array is recursively
- * flattened, otherwise it is only flattened a single level.
+ * flattened, otherwise it's only flattened a single level.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to flatten.
@@ -5078,11 +5079,11 @@
}
/**
* Gets the index at which the first occurrence of `value` is found in `array`
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it is used as the offset
+ * for equality comparisons. If `fromIndex` is negative, it's used as the offset
* from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
* performs a faster binary search.
*
* @static
* @memberOf _
@@ -5157,11 +5158,11 @@
var intersection = restParam(function(arrays) {
var othLength = arrays.length,
othIndex = othLength,
caches = Array(length),
indexOf = getIndexOf(),
- isCommon = indexOf == baseIndexOf,
+ isCommon = indexOf === baseIndexOf,
result = [];
while (othIndex--) {
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
@@ -5442,11 +5443,11 @@
}
/**
* Uses a binary search to determine the lowest index at which `value` should
* be inserted into `array` in order to maintain its sort order. If an iteratee
- * function is provided it is invoked for `value` and each element of `array`
+ * function is provided it's invoked for `value` and each element of `array`
* to compute their sort ranking. The iteratee is bound to `thisArg` and
* invoked with one argument; (value).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
@@ -5716,11 +5717,11 @@
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurence of each element
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
- * for sorted arrays. If an iteratee function is provided it is invoked for
+ * for sorted arrays. If an iteratee function is provided it's invoked for
* each element in the array to generate the criterion by which uniqueness
* is computed. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, array).
*
* If a property name is provided for `iteratee` the created `_.property`
@@ -5774,11 +5775,11 @@
}
var callback = getCallback();
if (!(iteratee == null && callback === baseCallback)) {
iteratee = callback(iteratee, thisArg, 3);
}
- return (isSorted && getIndexOf() == baseIndexOf)
+ return (isSorted && getIndexOf() === baseIndexOf)
? sortedUniq(array, iteratee)
: baseUniq(array, iteratee);
}
/**
@@ -6229,11 +6230,11 @@
*/
function wrapperReverse() {
var value = this.__wrapped__;
var interceptor = function(value) {
- return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
+ return value.reverse();
};
if (value instanceof LazyWrapper) {
var wrapped = value;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
@@ -6674,13 +6675,13 @@
result[key] = [value];
}
});
/**
- * Checks if `value` is in `collection` using
+ * Checks if `target` is in `collection` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it is used as the offset
+ * for equality comparisons. If `fromIndex` is negative, it's used as the offset
* from the end of `collection`.
*
* @static
* @memberOf _
* @alias contains, include
@@ -6771,11 +6772,11 @@
});
/**
* Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments
- * are provided to each invoked method. If `methodName` is a function it is
+ * are provided to each invoked method. If `methodName` is a function it's
* invoked for, and `this` bound to, each element in `collection`.
*
* @static
* @memberOf _
* @category Collection
@@ -7423,11 +7424,11 @@
/*------------------------------------------------------------------------*/
/**
* The opposite of `_.before`; this method creates a function that invokes
- * `func` once it is called `n` or more times.
+ * `func` once it's called `n` or more times.
*
* @static
* @memberOf _
* @category Function
* @param {number} n The number of calls before `func` is invoked.
@@ -7488,11 +7489,11 @@
return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
}
/**
* Creates a function that invokes `func`, with the `this` binding and arguments
- * of the created function, while it is called less than `n` times. Subsequent
+ * of the created function, while it's called less than `n` times. Subsequent
* calls to the created function return the result of the last `func` invocation.
*
* @static
* @memberOf _
* @category Function
@@ -7768,11 +7769,11 @@
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=false] Specify invoking on the leading
* edge of the timeout.
* @param {number} [options.maxWait] The maximum time `func` is allowed to be
- * delayed before it is invoked.
+ * delayed before it's invoked.
* @param {boolean} [options.trailing=true] Specify invoking on the trailing
* edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
@@ -7916,11 +7917,11 @@
return debounced;
}
/**
* Defers invoking the `func` until the current call stack has cleared. Any
- * additional arguments are provided to `func` when it is invoked.
+ * additional arguments are provided to `func` when it's invoked.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to defer.
@@ -7937,11 +7938,11 @@
return baseDelay(func, 1, args);
});
/**
* Invokes `func` after `wait` milliseconds. Any additional arguments are
- * provided to `func` when it is invoked.
+ * provided to `func` when it's invoked.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to delay.
@@ -8270,11 +8271,11 @@
/**
* Creates a function that invokes `func` with the `this` binding of the
* created function and arguments from `start` and beyond provided as an array.
*
- * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
+ * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to apply a rest parameter to.
@@ -8321,11 +8322,11 @@
/**
* Creates a function that invokes `func` with the `this` binding of the created
* function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
*
- * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
+ * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/Web/JavaScript/Reference/Operators/Spread_operator).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to spread arguments over.
@@ -8442,14 +8443,14 @@
/*------------------------------------------------------------------------*/
/**
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
- * otherwise they are assigned by reference. If `customizer` is provided it is
+ * otherwise they are assigned by reference. If `customizer` is provided it's
* invoked to produce the cloned values. If `customizer` returns `undefined`
* cloning is handled by the method instead. The `customizer` is bound to
- * `thisArg` and invoked with two argument; (value [, index|key, object]).
+ * `thisArg` and invoked with up to three argument; (value [, index|key, object]).
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
* The enumerable properties of `arguments` objects and objects created by
* constructors other than `Object` are cloned to plain `Object` objects. An
@@ -8501,19 +8502,19 @@
thisArg = customizer;
customizer = isDeep;
isDeep = false;
}
return typeof customizer == 'function'
- ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
+ ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3))
: baseClone(value, isDeep);
}
/**
- * Creates a deep clone of `value`. If `customizer` is provided it is invoked
+ * Creates a deep clone of `value`. If `customizer` is provided it's invoked
* to produce the cloned values. If `customizer` returns `undefined` cloning
* is handled by the method instead. The `customizer` is bound to `thisArg`
- * and invoked with two argument; (value [, index|key, object]).
+ * and invoked with up to three argument; (value [, index|key, object]).
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
* The enumerable properties of `arguments` objects and objects created by
* constructors other than `Object` are cloned to plain `Object` objects. An
@@ -8552,11 +8553,11 @@
* el.childNodes.length;
* // => 20
*/
function cloneDeep(value, customizer, thisArg) {
return typeof customizer == 'function'
- ? baseClone(value, true, bindCallback(customizer, thisArg, 1))
+ ? baseClone(value, true, bindCallback(customizer, thisArg, 3))
: baseClone(value, true);
}
/**
* Checks if `value` is greater than `other`.
@@ -8706,11 +8707,11 @@
function isElement(value) {
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
}
/**
- * Checks if `value` is empty. A value is considered empty unless it is an
+ * Checks if `value` is empty. A value is considered empty unless it's an
* `arguments` object, array, string, or jQuery-like collection with a length
* greater than `0` or an object with own enumerable properties.
*
* @static
* @memberOf _
@@ -8745,14 +8746,14 @@
return !keys(value).length;
}
/**
* Performs a deep comparison between two values to determine if they are
- * equivalent. If `customizer` is provided it is invoked to compare values.
+ * equivalent. If `customizer` is provided it's invoked to compare values.
* If `customizer` returns `undefined` comparisons are handled by the method
- * instead. The `customizer` is bound to `thisArg` and invoked with three
- * arguments: (value, other [, index|key]).
+ * instead. The `customizer` is bound to `thisArg` and invoked with up to
+ * three arguments: (value, other [, index|key]).
*
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
* numbers, `Object` objects, regexes, and strings. Objects are compared by
* their own, not inherited, enumerable properties. Functions and DOM nodes
* are **not** supported. Provide a customizer function to extend support
@@ -8864,11 +8865,11 @@
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
- // and Safari 8 equivalents which return 'object' for typed array constructors.
+ // and Safari 8 which returns 'object' for typed array constructors.
return isObject(value) && objToString.call(value) == funcTag;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
@@ -8898,11 +8899,11 @@
}
/**
* Performs a deep comparison between `object` and `source` to determine if
* `object` contains equivalent property values. If `customizer` is provided
- * it is invoked to compare values. If `customizer` returns `undefined`
+ * it's invoked to compare values. If `customizer` returns `undefined`
* comparisons are handled by the method instead. The `customizer` is bound
* to `thisArg` and invoked with three arguments: (value, other, index|key).
*
* **Note:** This method supports comparing properties of arrays, booleans,
* `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
@@ -9289,11 +9290,11 @@
/**
* Recursively merges own enumerable properties of the source object(s), that
* don't resolve to `undefined` into the destination object. Subsequent sources
* overwrite property assignments of previous sources. If `customizer` is
- * provided it is invoked to produce the merged values of the destination and
+ * provided it's invoked to produce the merged values of the destination and
* source properties. If `customizer` returns `undefined` merging is handled
* by the method instead. The `customizer` is bound to `thisArg` and invoked
* with five arguments: (objectValue, sourceValue, key, object, source).
*
* @static
@@ -9338,11 +9339,11 @@
var merge = createAssigner(baseMerge);
/**
* Assigns own enumerable properties of source object(s) to the destination
* object. Subsequent sources overwrite property assignments of previous sources.
- * If `customizer` is provided it is invoked to produce the assigned values.
+ * If `customizer` is provided it's invoked to produce the assigned values.
* The `customizer` is bound to `thisArg` and invoked with five arguments:
* (objectValue, sourceValue, key, object, source).
*
* **Note:** This method mutates `object` and is based on
* [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
@@ -9711,11 +9712,11 @@
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
- var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
+ var result = object == null ? undefined : baseGet(object, toPath(path), (path + ''));
return result === undefined ? defaultValue : result;
}
/**
* Checks if `path` is a direct property.
@@ -9888,11 +9889,11 @@
skipProto = support.enumPrototypes && isFunction(object);
while (++index < length) {
result[index] = (index + '');
}
- // lodash skips the `constructor` property when it infers it is iterating
+ // lodash skips the `constructor` property when it infers it's iterating
// over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
// attribute of an existing property and the `constructor` property of a
// prototype defaults to non-enumerable.
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
@@ -10054,11 +10055,11 @@
}
/**
* Creates an object composed of the picked `object` properties. Property
* names may be specified as individual arguments or as arrays of property
- * names. If `predicate` is provided it is invoked for each property of `object`
+ * names. If `predicate` is provided it's invoked for each property of `object`
* picking the properties `predicate` returns truthy for. The predicate is
* bound to `thisArg` and invoked with three arguments: (value, key, object).
*
* @static
* @memberOf _
@@ -10088,11 +10089,11 @@
: pickByArray(object, baseFlatten(props));
});
/**
* This method is like `_.get` except that if the resolved value is a function
- * it is invoked with the `this` binding of its parent object and its result
+ * it's invoked with the `this` binding of its parent object and its result
* is returned.
*
* @static
* @memberOf _
* @category Object
@@ -10129,11 +10130,11 @@
return isFunction(result) ? result.call(object) : result;
}
/**
* Sets the property value of `path` on `object`. If a portion of `path`
- * does not exist it is created.
+ * does not exist it's created.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to augment.
@@ -10287,11 +10288,11 @@
/*------------------------------------------------------------------------*/
/**
* Checks if `n` is between `start` and up to but not including, `end`. If
- * `end` is not specified it is set to `start` with `start` then set to `0`.
+ * `end` is not specified it's set to `start` with `start` then set to `0`.
*
* @static
* @memberOf _
* @category Number
* @param {number} n The number to check.
@@ -11251,11 +11252,11 @@
/*------------------------------------------------------------------------*/
/**
* Attempts to invoke `func`, returning either the result or the caught error
- * object. Any additional arguments are provided to `func` when it is invoked.
+ * object. Any additional arguments are provided to `func` when it's invoked.
*
* @static
* @memberOf _
* @category Utility
* @param {Function} func The function to attempt.
@@ -11649,17 +11650,17 @@
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
* // => [2, 0]
*/
function propertyOf(object) {
return function(path) {
- return baseGet(object, toPath(path), path + '');
+ return baseGet(object, toPath(path), (path + ''));
};
}
/**
* Creates an array of numbers (positive and/or negative) progressing from
- * `start` up to, but not including, `end`. If `end` is not specified it is
+ * `start` up to, but not including, `end`. If `end` is not specified it's
* set to `start` with `start` then set to `0`. If `end` is less than `start`
* a zero-length range is created unless a negative `step` is specified.
*
* @static
* @memberOf _
@@ -11848,11 +11849,11 @@
*/
var floor = createRound('floor');
/**
* Gets the maximum value of `collection`. If `collection` is empty or falsey
- * `-Infinity` is returned. If an iteratee function is provided it is invoked
+ * `-Infinity` is returned. If an iteratee function is provided it's invoked
* for each value in `collection` to generate the criterion by which the value
* is ranked. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
@@ -11897,11 +11898,11 @@
*/
var max = createExtremum(gt, NEGATIVE_INFINITY);
/**
* Gets the minimum value of `collection`. If `collection` is empty or falsey
- * `Infinity` is returned. If an iteratee function is provided it is invoked
+ * `Infinity` is returned. If an iteratee function is provided it's invoked
* for each value in `collection` to generate the criterion by which the value
* is ranked. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
@@ -12485,10 +12486,10 @@
// Map minified function names to their real names.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
- var key = lodashFunc.name,
+ var key = (lodashFunc.name + ''),
names = realNames[key] || (realNames[key] = []);
names.push({ 'name': methodName, 'func': lodashFunc });
}
});