diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js
index 9ea05059e..511eef9e1 100644
--- a/dist/lodash.compat.js
+++ b/dist/lodash.compat.js
@@ -116,10 +116,10 @@
/** Used to assign default `context` object properties */
var contextProps = [
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
- 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', 'Object',
- 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN',
- 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', 'Uint8ClampedArray',
- 'Uint16Array', 'Uint32Array', 'window', 'WinRTError'
+ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
+ 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document',
+ 'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'window', 'WinRTError'
];
/** Used to fix the JScript `[[DontEnum]]` bug */
@@ -586,7 +586,7 @@
/*--------------------------------------------------------------------------*/
/**
- * Create a new `lodash` function using the given `context` object.
+ * Create a new pristine `lodash` function using the given `context` object.
*
* @static
* @memberOf _
@@ -595,19 +595,22 @@
* @returns {Function} Returns a new `lodash` function.
* @example
*
+ * _.mixin({ 'add': function(a, b) { return a + b; } }, false);
+ *
* var lodash = _.runInContext();
+ * lodash.mixin({ 'sub': function(a, b) { return a - b; } }, false);
*
- * lodash.mixin({
- * 'exists': function(value) {
- * return value != null;
- * }
- * }, false);
- *
- * _.isFunction(lodash.exists);
+ * _.isFunction(_.add);
* // => true
*
- * _.isFunction(_.exists);
+ * _.isFunction(_.sub);
* // => false
+ *
+ * lodash.isFunction(lodash.add);
+ * // => false
+ *
+ * lodash.isFunction(lodash.sub);
+ * // => true
*/
function runInContext(context) {
// Avoid issues with some ES3 environments that attempt to use values, named
@@ -1193,7 +1196,7 @@
* @param {Array} array The array to iterate over.
* @param {Function} iterator The function called per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initFromArray=false] Specify using the first element of
+ * @param {boolean} [initFromArray=false] Specify using the last element of
* `array` as the initial value.
* @returns {*} Returns the accumulated value.
*/
@@ -1299,51 +1302,57 @@
* @returns {Function} Returns the new function.
*/
function baseCallback(func, thisArg, argCount) {
- if (typeof func != 'function') {
+ var type = typeof func;
+
+ if (type == 'function') {
+ if (typeof thisArg == 'undefined') {
+ return func;
+ }
+ var data = func[EXPANDO];
+ if (typeof data == 'undefined') {
+ if (support.funcNames) {
+ data = !func.name;
+ }
+ data = data || !support.funcDecomp;
+ if (!data) {
+ var source = fnToString.call(func);
+ if (!support.funcNames) {
+ data = !reFuncName.test(source);
+ }
+ if (!data) {
+ // checks if `func` references the `this` keyword and stores the result
+ data = reThis.test(source) || isNative(func);
+ setData(func, data);
+ }
+ }
+ }
+ // exit early if there are no `this` references or `func` is bound
+ if (data === false || (data !== true && data[1] & BIND_FLAG)) {
+ return func;
+ }
+ switch (argCount) {
+ case 1: return function(value) {
+ return func.call(thisArg, value);
+ };
+ case 3: return function(value, index, collection) {
+ return func.call(thisArg, value, index, collection);
+ };
+ case 4: return function(accumulator, value, index, collection) {
+ return func.call(thisArg, accumulator, value, index, collection);
+ };
+ case 5: return function(value, other, key, object, source) {
+ return func.call(thisArg, value, other, key, object, source);
+ };
+ }
+ return function() {
+ return func.apply(thisArg, arguments);
+ };
+ }
+ if (func == null) {
return identity;
}
- if (typeof thisArg == 'undefined') {
- return func;
- }
- var data = func[EXPANDO];
- if (typeof data == 'undefined') {
- if (support.funcNames) {
- data = !func.name;
- }
- data = data || !support.funcDecomp;
- if (!data) {
- var source = fnToString.call(func);
- if (!support.funcNames) {
- data = !reFuncName.test(source);
- }
- if (!data) {
- // checks if `func` references the `this` keyword and stores the result
- data = reThis.test(source) || isNative(func);
- setData(func, data);
- }
- }
- }
- // exit early if there are no `this` references or `func` is bound
- if (data === false || (data !== true && data[1] & BIND_FLAG)) {
- return func;
- }
- switch (argCount) {
- case 1: return function(value) {
- return func.call(thisArg, value);
- };
- case 3: return function(value, index, collection) {
- return func.call(thisArg, value, index, collection);
- };
- case 4: return function(accumulator, value, index, collection) {
- return func.call(thisArg, accumulator, value, index, collection);
- };
- case 5: return function(value, other, key, object, source) {
- return func.call(thisArg, value, other, key, object, source);
- };
- }
- return function() {
- return func.apply(thisArg, arguments);
- };
+ // handle "_.pluck" and "_.where" style callback shorthands
+ return type == 'object' ? matches(func) : property(func);
}
/**
@@ -1418,7 +1427,7 @@
if (Ctor instanceof Ctor) {
Ctor = ctorByClass[className];
}
- return new Ctor(cloneBuffer(value.buffer));
+ return new Ctor(cloneBuffer(value.buffer), value.byteOffset, value.length);
case numberClass:
case stringClass:
@@ -1607,7 +1616,7 @@
}
var index = -1,
indexOf = getIndexOf(),
- prereq = indexOf === baseIndexOf,
+ prereq = indexOf == baseIndexOf,
isLarge = prereq && createCache && values && values.length >= 200,
isCommon = prereq && !isLarge,
result = [],
@@ -2306,7 +2315,7 @@
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iterator The function called per iteration.
* @param {*} accumulator The initial value.
- * @param {boolean} initFromCollection Specify using the first element
+ * @param {boolean} initFromCollection Specify using the first or last element
* of `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
@@ -2377,18 +2386,14 @@
*
* @private
* @param {Array} array The array to inspect.
- * @param {boolean} [isSorted=false] Specify the array is sorted.
* @param {Function} [iterator] The function called per iteration.
* @returns {Array} Returns the new duplicate-value-free array.
*/
- function baseUniq(array, isSorted, iterator) {
- var length = array ? array.length : 0;
- if (!length) {
- return [];
- }
+ function baseUniq(array, iterator) {
var index = -1,
indexOf = getIndexOf(),
- prereq = !isSorted && indexOf === baseIndexOf,
+ length = array.length,
+ prereq = indexOf == baseIndexOf,
isLarge = prereq && createCache && length >= 200,
isCommon = prereq && !isLarge,
result = [];
@@ -2397,7 +2402,7 @@
var seen = createCache();
indexOf = cacheIndexOf;
} else {
- seen = (iterator && !isSorted) ? [] : result;
+ seen = iterator ? [] : result;
}
outer:
while (++index < length) {
@@ -2416,12 +2421,6 @@
}
result.push(value);
}
- else if (isSorted) {
- if (!index || seen !== computed) {
- seen = computed;
- result.push(value);
- }
- }
else if (indexOf(seen, computed) < 0) {
if (iterator || isLarge) {
seen.push(computed);
@@ -2531,7 +2530,7 @@
function createAggregator(setter, initializer) {
return function(collection, iterator, thisArg) {
var result = initializer ? initializer() : {};
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
if (isArray(collection)) {
var index = -1,
@@ -2808,6 +2807,21 @@
return baseCreateWrapper([func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]);
}
+ /**
+ * Gets the appropriate "callback" function. If the `_.callback` method is
+ * customized this function returns the custom method, otherwise it returns
+ * the `baseCallback` function. If arguments are provided the chosen function
+ * is executed with the arguments and its result is returned.
+ *
+ * @private
+ * @returns {Function} Returns the chosen function or its result.
+ */
+ function getCallback(func, thisArg, argCount) {
+ var result = lodash.callback || callback;
+ result = result === callback ? baseCallback : result;
+ return arguments.length ? result(func, thisArg, argCount) : result;
+ }
+
/**
* Finds the indexes of all placeholder elements in `array`.
*
@@ -2831,14 +2845,16 @@
/**
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is
* customized this function returns the custom method, otherwise it returns
- * the `baseIndexOf` function.
+ * the `baseIndexOf` function. If arguments are provided the chosen function
+ * is executed with the arguments and its result is returned.
*
* @private
- * @returns {Function} Returns the "indexOf" function.
+ * @returns {Function|number} Returns the chosen function or its result.
*/
- function getIndexOf() {
+ function getIndexOf(collection, target, fromIndex) {
var result = lodash.indexOf || indexOf;
- return result === indexOf ? baseIndexOf : result;
+ result = result === indexOf ? baseIndexOf : result;
+ return collection ? result(collection, target, fromIndex) : result;
}
/**
@@ -2867,6 +2883,18 @@
: (value && type == 'object' && reHostCtor.test(toString.call(value))) || false;
}
+ /**
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
+ * equality comparisons, else `false`.
+ */
+ function isStrictComparable(value) {
+ return value === value && (value === 0 ? (1 / value > 0) : !isObject(value));
+ }
+
/**
* Creates a clone of the given array buffer.
*
@@ -2983,6 +3011,33 @@
return result;
}
+ /**
+ * An implementation of `_.uniq` optimized for sorted arrays without support
+ * for callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iterator] The function called per iteration.
+ * @returns {Array} Returns the new duplicate-value-free array.
+ */
+ function sortedUniq(array, iterator) {
+ var seen,
+ index = -1,
+ length = array.length,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index],
+ computed = iterator ? iterator(value, index, array) : value;
+
+ if (!index || seen !== computed) {
+ seen = computed;
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
/**
* Converts `collection` to an array if it is not an array-like value.
*
@@ -3196,7 +3251,7 @@
var length = array ? array.length : 0,
index = length;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (index-- && predicate(array[index], index, array)) { }
return slice(array, 0, index + 1);
}
@@ -3244,7 +3299,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length && predicate(array[index], index, array)) { }
return slice(array, index);
}
@@ -3294,7 +3349,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length) {
if (predicate(array[index], index, array)) {
return index;
@@ -3347,7 +3402,7 @@
function findLastIndex(array, predicate, thisArg) {
var length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (length--) {
if (predicate(array[length], length, array)) {
return length;
@@ -3487,7 +3542,7 @@
argsLength = arguments.length,
caches = [],
indexOf = getIndexOf(),
- prereq = createCache && indexOf === baseIndexOf;
+ prereq = createCache && indexOf == baseIndexOf;
while (++argsIndex < argsLength) {
var value = arguments[argsIndex];
@@ -3691,7 +3746,7 @@
length = array ? array.length : 0,
result = [];
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
@@ -3806,7 +3861,7 @@
* // => 1
*/
function sortedIndex(array, value, iterator, thisArg) {
- iterator = iterator == null ? identity : lodash.callback(iterator, thisArg, 1);
+ iterator = iterator == null ? identity : getCallback(iterator, thisArg, 1);
return baseSortedIndex(array, value, iterator);
}
@@ -3832,7 +3887,7 @@
* // => 4
*/
function sortedLastIndex(array, value, iterator, thisArg) {
- iterator = iterator == null ? identity : lodash.callback(iterator, thisArg, 1);
+ iterator = iterator == null ? identity : getCallback(iterator, thisArg, 1);
return baseSortedIndex(array, value, iterator, true);
}
@@ -3941,7 +3996,7 @@
var length = array ? array.length : 0,
index = length;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (index-- && predicate(array[index], index, array)) { }
return slice(array, index + 1);
}
@@ -3989,7 +4044,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length && predicate(array[index], index, array)) { }
return slice(array, 0, index);
}
@@ -4073,9 +4128,11 @@
}
}
if (iterator != null) {
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
}
- return baseUniq(array, isSorted, iterator);
+ return (isSorted && getIndexOf() == baseIndexOf)
+ ? sortedUniq(array, iterator)
+ : baseUniq(array, iterator);
}
/**
@@ -4180,7 +4237,7 @@
/**
* Creates an object composed from arrays of property names and values. Provide
- * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+ * either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]`
* or two arrays, one of property names and one of corresponding values.
*
* @static
@@ -4413,8 +4470,7 @@
? nativeContains.call(collection, target, fromIndex)
: collection.indexOf(target, fromIndex) > -1;
}
- var indexOf = getIndexOf();
- return indexOf(collection, target, fromIndex) > -1;
+ return getIndexOf(collection, target, fromIndex) > -1;
}
/**
@@ -4498,7 +4554,7 @@
*/
function every(collection, predicate, thisArg) {
if (typeof predicate != 'function' || typeof thisArg != 'undefined') {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
}
var func = isArray(collection) ? arrayEvery : baseEvery;
return func(collection, predicate);
@@ -4545,7 +4601,7 @@
* // => [{ 'name': 'barney', 'age': 36 }]
*/
function filter(collection, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, predicate);
@@ -4599,7 +4655,7 @@
var index = findIndex(collection, predicate, thisArg);
return index > -1 ? collection[index] : undefined;
}
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(collection, predicate, baseEach);
}
@@ -4622,7 +4678,7 @@
* // => 3
*/
function findLast(collection, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(collection, predicate, baseEachRight);
}
@@ -4861,7 +4917,7 @@
* // => ['barney', 'fred']
*/
function map(collection, iterator, thisArg) {
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
var func = isArray(collection) ? arrayMap : baseMap;
return func(collection, iterator);
@@ -4919,20 +4975,25 @@
if ((type == 'number' || type == 'string') && thisArg && thisArg[iterator] === collection) {
iterator = null;
}
- if (iterator == null && isArray(collection)) {
+ var noIterator = iterator == null,
+ isArr = noIterator && isArray(collection),
+ isStr = !isArr && isString(collection);
+
+ if (noIterator && !isStr) {
var index = -1,
- length = collection.length;
+ iterable = toIterable(collection),
+ length = iterable.length;
while (++index < length) {
- var value = collection[index];
+ var value = iterable[index];
if (value > result) {
result = value;
}
}
} else {
- iterator = (iterator == null && isString(collection))
+ iterator = (noIterator && isStr)
? charAtCallback
- : lodash.callback(iterator, thisArg, 3);
+ : getCallback(iterator, thisArg, 3);
baseEach(collection, function(value, index, collection) {
var current = iterator(value, index, collection);
@@ -4997,20 +5058,25 @@
if ((type == 'number' || type == 'string') && thisArg && thisArg[iterator] === collection) {
iterator = null;
}
- if (iterator == null && isArray(collection)) {
+ var noIterator = iterator == null,
+ isArr = noIterator && isArray(collection),
+ isStr = !isArr && isString(collection);
+
+ if (noIterator && !isStr) {
var index = -1,
- length = collection.length;
+ iterable = toIterable(collection),
+ length = iterable.length;
while (++index < length) {
- var value = collection[index];
+ var value = iterable[index];
if (value < result) {
result = value;
}
}
} else {
- iterator = (iterator == null && isString(collection))
+ iterator = (noIterator && isStr)
? charAtCallback
- : lodash.callback(iterator, thisArg, 3);
+ : getCallback(iterator, thisArg, 3);
baseEach(collection, function(value, index, collection) {
var current = iterator(value, index, collection);
@@ -5124,7 +5190,7 @@
*/
function reduce(collection, iterator, accumulator, thisArg) {
var func = isArray(collection) ? arrayReduce : baseReduce;
- return func(collection, lodash.callback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEach);
+ return func(collection, getCallback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEach);
}
/**
@@ -5148,7 +5214,7 @@
*/
function reduceRight(collection, iterator, accumulator, thisArg) {
var func = isArray(collection) ? arrayReduceRight : baseReduce;
- return func(collection, lodash.callback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEachRight);
+ return func(collection, getCallback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEachRight);
}
/**
@@ -5190,7 +5256,7 @@
* // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
*/
function reject(collection, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return filter(collection, negate(predicate));
}
@@ -5327,7 +5393,7 @@
*/
function some(collection, predicate, thisArg) {
if (typeof predicate != 'function' || typeof thisArg != 'undefined') {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
}
var func = isArray(collection) ? arraySome : baseSome;
return func(collection, predicate);
@@ -5392,7 +5458,7 @@
result.length = length;
}
if (!multi) {
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
}
baseEach(collection, function(value, key, collection) {
if (multi) {
@@ -6488,7 +6554,7 @@
* // => 'fred'
*/
function findKey(object, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(object, predicate, baseForOwn, true);
}
@@ -6534,7 +6600,7 @@
* // => 'pebbles'
*/
function findLastKey(object, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(object, predicate, baseForOwnRight, true);
}
@@ -6740,7 +6806,7 @@
}
/**
- * Checks if `value` is an `arguments` object.
+ * Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
@@ -6762,19 +6828,20 @@
// fallback for environments without a `[[Class]]` for `arguments` objects
if (!support.argsClass) {
isArguments = function(value) {
- return (value && typeof value == 'object' && typeof value.length == 'number' &&
+ var length = (value && typeof value == 'object') ? value.length : undefined;
+ return (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER &&
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee')) || false;
};
}
/**
- * Checks if `value` is an array.
+ * Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -6789,13 +6856,13 @@
};
/**
- * Checks if `value` is a boolean value.
+ * Checks if `value` is classified as a boolean primitive or object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a boolean value, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isBoolean(false);
@@ -6810,13 +6877,13 @@
}
/**
- * Checks if `value` is a `Date` object.
+ * Checks if `value` is classified as a `Date` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isDate(new Date);
@@ -6938,23 +7005,9 @@
*/
function isEqual(value, other, customizer, thisArg) {
customizer = typeof customizer == 'function' && baseCallback(customizer, thisArg, 3);
-
- if (!customizer) {
- // exit early for identical values
- if (value === other) {
- // treat `-0` vs. `+0` as not equal
- return value !== 0 || (1 / value == 1 / other);
- }
- var valType = typeof value,
- othType = typeof other;
-
- // exit early for unlike primitive values
- if (value === value && (value == null || other == null ||
- (valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object'))) {
- return false;
- }
- }
- return baseIsEqual(value, other, customizer);
+ return (!customizer && isStrictComparable(value) && isStrictComparable(other))
+ ? value === other
+ : baseIsEqual(value, other, customizer);
}
/**
@@ -6979,7 +7032,7 @@
}
/**
- * Checks if `value` is a finite number.
+ * Checks if `value` is a finite primitive number.
*
* Note: This method is based on ES6 `Number.isFinite`. See the
* [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite)
@@ -6989,7 +7042,7 @@
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is finite, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* @example
*
* _.isFinite(10);
@@ -7012,13 +7065,13 @@
};
/**
- * Checks if `value` is a function.
+ * Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
@@ -7121,16 +7174,16 @@
}
/**
- * Checks if `value` is a `Number` primitive or object.
+ * Checks if `value` is classified as a `Number` primitive or object.
*
- * Note: `NaN` is considered a number. See the [ES5 spec](http://es5.github.io/#x8.5)
- * for more details.
+ * Note: To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
+ * as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a number, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isNumber(8.4);
@@ -7192,13 +7245,13 @@
};
/**
- * Checks if `value` is a `RegExp` object.
+ * Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a regexp object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -7212,13 +7265,13 @@
}
/**
- * Checks if `value` is a `String` primitive or object.
+ * Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
@@ -7398,7 +7451,7 @@
*/
function mapValues(object, iterator, thisArg) {
var result = {};
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
baseForOwn(object, function(value, key, object) {
result[key] = iterator(value, key, object);
@@ -7491,7 +7544,7 @@
return {};
}
if (typeof predicate == 'function') {
- return basePick(object, negate(lodash.callback(predicate, thisArg, 3)));
+ return basePick(object, negate(getCallback(predicate, thisArg, 3)));
}
var omitProps = baseFlatten(arguments, false, false, 1);
return basePick(Object(object), baseDifference(keysIn(object), arrayMap(omitProps, String)));
@@ -7499,7 +7552,7 @@
/**
* Creates a two dimensional array of a given object's key-value pairs,
- * i.e. `[[key1, value1], [key2, value2]]`.
+ * e.g. `[[key1, value1], [key2, value2]]`.
*
* @static
* @memberOf _
@@ -7557,7 +7610,7 @@
}
return basePick(Object(object),
typeof predicate == 'function'
- ? lodash.callback(predicate, thisArg, 3)
+ ? getCallback(predicate, thisArg, 3)
: baseFlatten(arguments, false, false, 1)
);
}
@@ -7608,7 +7661,7 @@
}
}
if (iterator) {
- iterator = lodash.callback(iterator, thisArg, 4);
+ iterator = getCallback(iterator, thisArg, 4);
(isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
return iterator(accumulator, value, index, object);
});
@@ -7768,7 +7821,11 @@
* // => 'fred, barney, & pebbles'
*/
function escape(string) {
- return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+ // reset `lastIndex` because in IE < 9 `String#replace` does not
+ string = string == null ? '' : String(string);
+ return (reUnescapedHtml.lastIndex = 0, reUnescapedHtml.test(string))
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
+ : string;
}
/**
@@ -7786,7 +7843,10 @@
* // => '\[lodash\]\(http://lodash\.com\)'
*/
function escapeRegExp(string) {
- return string == null ? '' : String(string).replace(reRegExpChars, '\\$&');
+ string = string == null ? '' : String(string);
+ return (reRegExpChars.lastIndex = 0, reRegExpChars.test(string))
+ ? string.replace(reRegExpChars, '\\$&')
+ : string;
}
/**
@@ -7937,6 +7997,9 @@
return result;
}
string = String(string);
+
+ // leverage the exponentiation by squaring algorithm for a faster repeat
+ // http://en.wikipedia.org/wiki/Exponentiation_by_squaring
do {
if (n % 2) {
result += string;
@@ -8007,7 +8070,7 @@
* properties may be accessed as free variables in the template. If a setting
* object is provided it overrides `_.templateSettings` for the template.
*
- * Note: In the development build, `_.template` utilizes sourceURLs 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.
*
@@ -8046,22 +8109,27 @@
* compiled({ 'people': ['fred', 'barney'] });
* // => '
fredbarney'
*
- * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
- * var compiled = _.template('hello ${ name }');
- * compiled({ 'name': 'pebbles' });
- * // => 'hello pebbles'
- *
* // using the internal `print` function in "evaluate" delimiters
* var compiled = _.template('<% print("hello " + name); %>!');
* compiled({ 'name': 'barney' });
* // => 'hello barney!'
*
- * // using a custom template delimiters
+ * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+ * var compiled = _.template('hello ${ name }');
+ * compiled({ 'name': 'pebbles' });
+ * // => 'hello pebbles'
+ *
+ * // using custom template delimiters
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ name }}!');
* compiled({ 'name': 'mustache' });
* // => 'hello mustache!'
*
+ * // using backslashes to treat delimiters as plain text
+ * var compiled = _.template('<%= "\\<%- value %\\>" %>');
+ * compiled({ 'value': 'ignored' });
+ * // => '<%- value %>'
+ *
* // using the `imports` option to import `jQuery` as `jq`
* var text = '<% jq.each(people, function(name) { %><%- name %><% }); %>';
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
@@ -8377,11 +8445,10 @@
* // => 'fred, barney & pebbles'
*/
function unescape(string) {
- if (string == null) {
- return '';
- }
- string = String(string);
- return string.indexOf(';') < 0 ? string : string.replace(reEscapedHtml, unescapeHtmlChar);
+ string = string == null ? '' : String(string);
+ return (reEscapedHtml.lastIndex = 0, reEscapedHtml.test(string))
+ ? string.replace(reEscapedHtml, unescapeHtmlChar)
+ : string;
}
/*--------------------------------------------------------------------------*/
@@ -8425,7 +8492,6 @@
* @category Utility
* @param {*} [func=identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of the created callback.
- * @param {number} [argCount] The number of arguments the callback accepts.
* @returns {Function} Returns the new function.
* @example
*
@@ -8435,9 +8501,12 @@
* ];
*
* // wrap to create custom callback shorthands
- * _.callback = _.wrap(_.callback, function(func, callback, thisArg) {
- * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
- * return !match ? func(callback, thisArg) : function(object) {
+ * _.callback = _.wrap(_.callback, function(callback, func, thisArg) {
+ * var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
+ * if (!match) {
+ * return callback(func, thisArg);
+ * }
+ * return function(object) {
* return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
* };
* });
@@ -8445,18 +8514,8 @@
* _.filter(characters, 'age__gt38');
* // => [{ 'name': 'fred', 'age': 40 }]
*/
- function callback(func, thisArg, argCount) {
- var type = typeof func,
- isFunc = type == 'function';
-
- if (isFunc && typeof thisArg == 'undefined') {
- return func;
- }
- if (isFunc || func == null) {
- return baseCallback(func, thisArg, argCount);
- }
- // handle "_.pluck" and "_.where" style callback shorthands
- return type == 'object' ? matches(func) : property(func);
+ function callback(func, thisArg) {
+ return baseCallback(func, thisArg);
}
/**
@@ -8525,17 +8584,28 @@
*/
function matches(source) {
var props = keys(source),
- length = props.length,
- index = length,
- modes = Array(length),
+ length = props.length;
+
+ if (length == 1) {
+ var key = props[0],
+ value = source[key];
+
+ if (isStrictComparable(value)) {
+ return function(object) {
+ return object != null && value === object[key] && hasOwnProperty.call(object, key);
+ };
+ }
+ }
+ var index = length,
+ flags = Array(length),
vals = Array(length);
while (index--) {
- var value = source[props[index]],
- isDeep = value !== value || (value === 0 && 1 / value < 0) || isObject(value);
+ value = source[props[index]];
+ var isStrict = isStrictComparable(value);
- modes[index] = isDeep;
- vals[index] = isDeep ? baseClone(value, isDeep) : value;
+ flags[index] = isStrict;
+ vals[index] = isStrict ? value : baseClone(value, false);
}
return function(object) {
index = length;
@@ -8543,13 +8613,13 @@
return !index;
}
while (index--) {
- if (modes[index] ? !hasOwnProperty.call(object, props[index]) : vals[index] !== object[props[index]]) {
+ if (flags[index] ? vals[index] !== object[props[index]] : !hasOwnProperty.call(object, props[index])) {
return false;
}
}
index = length;
while (index--) {
- if (modes[index] ? !baseIsEqual(vals[index], object[props[index]], null, true) : !hasOwnProperty.call(object, props[index])) {
+ if (flags[index] ? !hasOwnProperty.call(object, props[index]) : !baseIsEqual(vals[index], object[props[index]], null, true)) {
return false;
}
}
diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js
index b83c8d8f1..0891d946b 100644
--- a/dist/lodash.compat.min.js
+++ b/dist/lodash.compat.min.js
@@ -4,70 +4,70 @@
* Build: `lodash -o ./dist/lodash.compat.js`
*/
;(function(){function n(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202i(t,f)&&c.push(f);return c}function zt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>S)return Ht(n,t);for(var e=-1,u=Or(n);++e=r||r>S)return Qt(n,t);for(var e=Or(n);r--&&false!==t(e[r],r,n););return n
-}function Zt(n,t){var r=true;return zt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Kt(n,t){var r=[];return zt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Vt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Yt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,a=r(n[i]);(e?a<=t:aa(s,h)&&((u||c)&&s.push(h),l.push(p))}return l}function pr(n,t){for(var r=-1,e=t(n),u=e.length,o=we(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?au(u+e,0):e||0;else if(e)return e=Ur(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Rr(n){return Fr(n,1)}function Fr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=au(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=au(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=we(u);++er?au(e+r,0):r||0:0,typeof n=="string"||!ku(n)&&le(n)?ro&&(o=a)}else t=null==t&&le(n)?u:K.callback(t,r,3),zt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)});return o}function Vr(n,t){return Zr(n,_e(t))
-}function Yr(n,t,r,e){return(ku(n)?Ct:fr)(n,K.callback(t,e,4),r,3>arguments.length,zt)}function Jr(n,t,r,e){return(ku(n)?Rt:fr)(n,K.callback(t,e,4),r,3>arguments.length,qt)}function Xr(n){n=Or(n);for(var t=-1,r=n.length,e=we(r);++t=r||r>t?(a&&ze(a),r=p,a=s=p=d,r&&(h=Uu(),f=n.apply(l,i),s||a||(i=l=null))):s=Ge(e,r)}function u(){s&&ze(s),a=s=p=d,(v||g!==t)&&(h=Uu(),f=n.apply(l,i),s||a||(i=l=null))}function o(){if(i=arguments,c=Uu(),l=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=c);var o=g-(c-h),m=0>=o||o>g;m?(a&&(a=ze(a)),h=c,f=n.apply(l,i)):a||(a=Ge(u,o))}return m&&s?s=ze(s):s||t===g||(s=Ge(e,t)),r&&(m=true,f=n.apply(l,i)),!m||s||a||(i=l=null),f}var i,a,f,c,l,s,p,h=0,g=false,v=true;
-if(!ie(n))throw new Se(I);if(t=0>t?0:t,true===r)var y=true,v=false;else ae(r)&&(y=r.leading,g="maxWait"in r&&au(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&ze(s),a&&ze(a),a=s=p=d},o}function ne(n){if(!ie(n))throw new Se(I);return function(){return!n.apply(this,arguments)}}function te(n){return or(n,k,Fr(arguments,1))}function re(n){return nr(n,se)}function ee(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Pe.call(n)==tt||false}function ue(n){return n&&typeof n=="object"&&1===n.nodeType&&(yu.nodeClass?-1t||null==n||!ou(t))return r;n=Ce(n);do t%2&&(r+=n),t=Ze(t/2),n+=n;while(t);return r}function ve(n,t){return(n=null==n?"":Ce(n))?null==t?n.slice(g(n),v(n)+1):(t=Ce(t),n.slice(o(n,t),i(n,t)+1)):n
-}function ye(n){try{return n()}catch(t){return oe(t)?t:Ae(t)}}function me(n){return n}function de(n){for(var t=Iu(n),r=t.length,e=r,u=we(r),o=we(r);e--;){var i=n[t[e]],a=i!==i||0===i&&0>1/i||ae(i);u[e]=a,o[e]=a?Pt(i,a):i}return function(n){if(e=r,null==n)return!e;for(;e--;)if(u[e]?!Ve.call(n,t[e]):o[e]!==n[t[e]])return false;for(e=r;e--;)if(u[e]?!tr(o[e],n[t[e]],null,true):!Ve.call(n,t[e]))return false;return true}}function be(n,t,r){var e=true,u=t&&nr(t,Iu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=nr(t,Iu)),false===r?e=false:ae(r)&&"chain"in r&&(e=r.chain),r=-1;
-for(var o=ie(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},K.assign=xu,K.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1arguments.length?br(n,_,null,t):or(n,_|k,Fr(arguments,2),t)},K.bindAll=function(n){for(var t=n,r=1arguments.length?br(t,_|w,null,n):br(t,_|w|k,null,n,Fr(arguments,2))},K.callback=function(n,t,r){var e=typeof n,u="function"==e;return u&&typeof t=="undefined"?n:u||null==n?Wt(n,t,r):"object"==e?de(n):_e(n)},K.chain=function(n){return n=K(n),n.__chain__=true,n},K.chunk=function(n,t){var r=0,e=n?n.length:0,u=[];for(t=au(+t||1,1);rt?0:t)},K.dropRight=function(n,t,r){var e=n?n.length:0;
-return t=e-((null==t||r?1:t)||0),Fr(n,0,0>t?0:t)},K.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=K.callback(t,r,3);e--&&t(n[e],e,n););return Fr(n,0,e+1)},K.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=K.callback(t,r,3);++e(p?e(p,f):i(s,f))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,f):i(n[t],f)))continue n}p&&p.push(f),s.push(f)}return s},K.invert=function(n,t){for(var r=-1,e=Iu(n),u=e.length,o={};++rt?0:t)},K.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Fr(n,0>t?0:t)},K.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=K.callback(t,r,3);e--&&t(n[e],e,n););return Fr(n,e+1)
-},K.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=K.callback(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},K.escape=function(n){return null==n?"":Ce(n).replace(W,s)},K.escapeRegExp=he,K.every=Br,K.find=Mr,K.findIndex=Ir,K.findKey=function(n,t,r){return t=K.callback(t,r,3),Vt(n,t,Ht,true)},K.findLast=function(n,t,r){return t=K.callback(t,r,3),Vt(n,t,qt)},K.findLastIndex=function(n,t,r){var e=n?n.length:0;
-for(t=K.callback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},K.findLastKey=function(n,t,r){return t=K.callback(t,r,3),Vt(n,t,Qt,true)},K.findWhere=function(n,t){return Mr(n,de(t))},K.first=Cr,K.has=function(n,t){return n?Ve.call(n,t):false},K.identity=me,K.indexOf=Sr,K.isArguments=ee,K.isArray=ku,K.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Pe.call(n)==et||false},K.isDate=function(n){return n&&typeof n=="object"&&Pe.call(n)==ut||false},K.isElement=ue,K.isEmpty=function(n){if(null==n)return true;
-var t=n.length;return typeof t=="number"&&-1r?au(u+r,0):fu(r||0,u-1))+1;else if(r)return u=Tr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},K.max=Kr,K.min=function(n,t,r){var e=1/0,o=e,i=typeof t;if("number"!=i&&"string"!=i||!r||r[t]!==n||(t=null),null==t&&ku(n))for(r=-1,i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},K.template=function(n,t){var r=K.templateSettings;t=xu({},t,r,Lt),n=Ce(null==n?"":n);
-var e,u,r=xu({},t.imports,r.imports,Lt),o=Iu(r),i=pe(r),a=0,r=t.interpolate||V,f="__p+='",r=Ie((t.escape||V).source+"|"+r.source+"|"+(r===B?D:V).source+"|"+(t.evaluate||V).source+"|$","g");if(n.replace(r,function(t,r,o,i,c,l){return o||(o=i),f+=n.slice(a,l).replace(X,p),r&&(e=true,f+="'+__e("+r+")+'"),c&&(u=true,f+="';"+c+";\n__p+='"),o&&(f+="'+((__t=("+o+"))==null?'':__t)+'"),a=l+t.length,t}),f+="';",(r=t.variable)||(f="with(obj){"+f+"}"),f=(u?f.replace(U,""):f).replace(T,"$1").replace(L,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(e?",__e=_.escape":"")+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}",r=ye(function(){return xe(o,"return "+f).apply(d,i)
-}),r.source=f,oe(r))throw r;return r},K.trim=ve,K.trimLeft=function(n,t){return(n=null==n?"":Ce(n))?null==t?n.slice(g(n)):(t=Ce(t),n.slice(o(n,t))):n},K.trimRight=function(n,t){return(n=null==n?"":Ce(n))?null==t?n.slice(0,v(n)+1):(t=Ce(t),n.slice(0,i(n,t)+1)):n},K.trunc=function(n,t){var r=30,e="...";if(ae(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Ce(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Ce(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e;
-if(r=n.slice(0,o),null==u)return r+e;if(ce(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Ie(u.source,(M.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(N,y))},K.uniqueId=function(n){var t=++R;return Ce(null==n?"":n)+t},K.all=Br,K.any=Gr,K.detect=Mr,K.foldl=Yr,K.foldr=Jr,K.head=Cr,K.include=$r,K.inject=Yr,be(K,function(){var n={};
-return Ht(K,function(t,r){K.prototype[r]||(n[r]=t)}),n}(),false),K.sample=function(n,t,r){n=Or(n);var e=n.length;return null==t||r?0t?0:+t||0,n.length),n)},Ht(K,function(n,t){var r="sample"!=t;K.prototype[t]||(K.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new G(o,u):o})}),K.VERSION=b,K.prototype.chain=function(){return this.__chain__=true,this},K.prototype.toJSON=Pr,K.prototype.toString=function(){return Ce(this.__wrapped__)
-},K.prototype.value=Pr,K.prototype.valueOf=Pr,kt(["join","pop","shift"],function(n){var t=Re[n];K.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new G(r,n):r}}),kt(["push","reverse","sort","unshift"],function(n){var t=Re[n];K.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),kt(["concat","splice"],function(n){var t=Re[n];K.prototype[n]=function(){return new G(t.apply(this.__wrapped__,arguments),this.__chain__)}}),yu.spliceObjects||kt(["pop","shift","splice"],function(n){var t=Re[n],r="splice"==n;
-K.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new G(u,n):u}}),K}var d,b="3.0.0-pre",_=1,w=2,j=4,A=8,x=16,k=32,E=64,O="__lodash@"+b+"__",I="Expected a function",C=Math.pow(2,32)-1,S=Math.pow(2,53)-1,R=0,F=/^[A-Z]+$/,U=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,L=/(__e\(.*?\)|\b__t\))\+'';/g,N=/&(?:amp|lt|gt|quot|#39|#96);/g,W=/[&<>"'`]/g,P=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,Z=/^\[object .+?Constructor\]$/,K=/[\xC0-\xFF]/g,V=/($^)/,Y=/[.*+?^${}()|[\]\/\\]/g,J=/\bthis\b/,X=/['\n\r\u2028\u2029\\]/g,G=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,H=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Q="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),nt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Error]",it="[object Function]",at="[object Number]",ft="[object Object]",ct="[object RegExp]",lt="[object String]",st="[object ArrayBuffer]",pt="[object Float32Array]",ht="[object Float64Array]",gt="[object Int8Array]",vt="[object Int16Array]",yt="[object Int32Array]",mt="[object Uint8Array]",dt="[object Uint8ClampedArray]",bt="[object Uint16Array]",_t="[object Uint32Array]",wt={};
-wt[tt]=wt[rt]=wt[pt]=wt[ht]=wt[gt]=wt[vt]=wt[yt]=wt[mt]=wt[dt]=wt[bt]=wt[_t]=true,wt[st]=wt[et]=wt[ut]=wt[ot]=wt[it]=wt["[object Map]"]=wt[at]=wt[ft]=wt[ct]=wt["[object Set]"]=wt[lt]=wt["[object WeakMap]"]=false;var jt={};jt[tt]=jt[rt]=jt[st]=jt[et]=jt[ut]=jt[pt]=jt[ht]=jt[gt]=jt[vt]=jt[yt]=jt[at]=jt[ft]=jt[ct]=jt[lt]=jt[mt]=jt[dt]=jt[bt]=jt[_t]=true,jt[ot]=jt[it]=jt["[object Map]"]=jt["[object Set]"]=jt["[object WeakMap]"]=false;var At={leading:false,maxWait:0,trailing:false},xt={configurable:false,enumerable:false,value:null,writable:false},kt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Et={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ot={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},It={"function":true,object:true},Ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},St=It[typeof window]&&window||this,Rt=It[typeof exports]&&exports&&!exports.nodeType&&exports,It=It[typeof module]&&module&&!module.nodeType&&module,Ft=Rt&&It&&typeof global=="object"&&global;
-!Ft||Ft.global!==Ft&&Ft.window!==Ft&&Ft.self!==Ft||(St=Ft);var Ft=It&&It.exports===Rt&&Rt,Ut=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(St._=Ut, define(function(){return Ut})):Rt&&It?Ft?(It.exports=Ut)._=Ut:Rt._=Ut:St._=Ut}).call(this);
\ No newline at end of file
+}function a(n,r){return t(n.a,r.a)||n.b-r.b}function f(n,r){for(var e=-1,u=n.a,o=r.a,i=u.length;++ee||13e||8202r||13r||8202i(t,f)&&c.push(f);return c}function zt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>k)return Ht(n,t);for(var e=-1,u=Sr(n);++e=r||r>k)return Qt(n,t);for(var e=Sr(n);r--&&false!==t(e[r],r,n););return n}function Zt(n,t){var r=true;return zt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Kt(n,t){var r=[];return zt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Vt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Yt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,a=r(n[i]);(e?a<=t:ao(l,p)&&((t||f)&&l.push(p),c.push(s))}return c}function pr(n,t){for(var r=-1,e=t(n),u=e.length,o=xe(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?lu(u+e,0):e||0;else if(e)return e=Lr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Ur(n){return Tr(n,1)}function Tr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=lu(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=lu(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=xe(u);++er?lu(e+r,0):r||0:0,typeof n=="string"||!Cu(n)&&pe(n)?ro&&(o=a);else t=i&&a?u:br(t,r,3),zt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)
+});return o}function Jr(n,t){return Vr(n,Ae(t))}function Xr(n,t,r,e){return(Cu(n)?St:fr)(n,br(t,e,4),r,3>arguments.length,zt)}function Gr(n,t,r,e){return(Cu(n)?Rt:fr)(n,br(t,e,4),r,3>arguments.length,qt)}function Hr(n){n=Sr(n);for(var t=-1,r=n.length,e=xe(r);++t=r||r>t?(a&&Ke(a),r=p,a=s=p=d,r&&(h=Wu(),f=n.apply(l,i),s||a||(i=l=null))):s=nu(e,r)}function u(){s&&Ke(s),a=s=p=d,(v||g!==t)&&(h=Wu(),f=n.apply(l,i),s||a||(i=l=null))}function o(){if(i=arguments,c=Wu(),l=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=c);var o=g-(c-h),m=0>=o||o>g;m?(a&&(a=Ke(a)),h=c,f=n.apply(l,i)):a||(a=nu(u,o))}return m&&s?s=Ke(s):s||t===g||(s=nu(e,t)),r&&(m=true,f=n.apply(l,i)),!m||s||a||(i=l=null),f}var i,a,f,c,l,s,p,h=0,g=false,v=true;
+if(!fe(n))throw new Ue(C);if(t=0>t?0:t,true===r)var y=true,v=false;else ce(r)&&(y=r.leading,g="maxWait"in r&&lu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Ke(s),a&&Ke(a),a=s=p=d},o}function re(n){if(!fe(n))throw new Ue(C);return function(){return!n.apply(this,arguments)}}function ee(n){return or(n,E,Tr(arguments,1))}function ue(n){return nr(n,he)}function oe(n){return n&&typeof n=="object"&&typeof n.length=="number"&&De.call(n)==tt||false}function ie(n){return n&&typeof n=="object"&&1===n.nodeType&&(_u.nodeClass?-1t||null==n||!fu(t))return r;n=Fe(n);do t%2&&(r+=n),t=Ye(t/2),n+=n;
+while(t);return r}function me(n,t){return(n=null==n?"":Fe(n))?null==t?n.slice(g(n),v(n)+1):(t=Fe(t),n.slice(o(n,t),i(n,t)+1)):n}function de(n){try{return n()}catch(t){return ae(t)?t:Oe(t)}}function _e(n,t){return Nt(n,t)}function be(n){return n}function we(n){var t=Ru(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Er(u))return function(n){return null!=n&&u===n[e]&&Xe.call(n,e)}}for(var o=r,i=xe(r),a=xe(r);o--;){var u=n[t[o]],f=Er(u);i[o]=f,a[o]=f?u:Pt(u,false)}return function(n){if(o=r,null==n)return!o;
+for(;o--;)if(i[o]?a[o]!==n[t[o]]:!Xe.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!Xe.call(n,t[o]):!tr(a[o],n[t[o]],null,true))return false;return true}}function je(n,t,r){var e=true,u=t&&nr(t,Ru);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=nr(t,Ru)),false===r?e=false:ce(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=fe(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},K.assign=Iu,K.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1arguments.length?_r(n,b,null,t):or(n,b|E,Tr(arguments,2),t)},K.bindAll=function(n){for(var t=n,r=1arguments.length?_r(t,b|w,null,n):_r(t,b|w|E,null,n,Tr(arguments,2))},K.callback=_e,K.chain=function(n){return n=K(n),n.__chain__=true,n},K.chunk=function(n,t){var r=0,e=n?n.length:0,u=[];for(t=lu(+t||1,1);rt?0:t)},K.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Tr(n,0,0>t?0:t)},K.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--&&t(n[e],e,n););return Tr(n,0,e+1)
+},K.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=br(t,r,3);++e(p?e(p,f):i(s,f))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,f):i(n[t],f)))continue n
+}p&&p.push(f),s.push(f)}return s},K.invert=function(n,t){for(var r=-1,e=Ru(n),u=e.length,o={};++rt?0:t)},K.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Tr(n,0>t?0:t)},K.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--&&t(n[e],e,n););return Tr(n,e+1)},K.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=br(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},K.escape=function(n){return n=null==n?"":Fe(n),N.lastIndex=0,N.test(n)?n.replace(N,s):n
+},K.escapeRegExp=ve,K.every=Mr,K.find=qr,K.findIndex=kr,K.findKey=function(n,t,r){return t=br(t,r,3),Vt(n,t,Ht,true)},K.findLast=function(n,t,r){return t=br(t,r,3),Vt(n,t,qt)},K.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},K.findLastKey=function(n,t,r){return t=br(t,r,3),Vt(n,t,Qt,true)},K.findWhere=function(n,t){return qr(n,we(t))},K.first=Rr,K.has=function(n,t){return n?Xe.call(n,t):false},K.identity=be,K.indexOf=Fr,K.isArguments=oe,K.isArray=Cu,K.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&De.call(n)==et||false
+},K.isDate=function(n){return n&&typeof n=="object"&&De.call(n)==ut||false},K.isElement=ie,K.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?lu(u+r,0):su(r||0,u-1))+1;else if(r)return u=Wr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},K.max=Yr,K.min=function(n,t,r){var e=1/0,o=e,i=typeof t;"number"!=i&&"string"!=i||!r||r[t]!==n||(t=null);var i=null==t,a=!(i&&Cu(n))&&pe(n);if(i&&!a)for(r=-1,n=Sr(n),i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},K.template=function(n,t){var r=K.templateSettings;t=Iu({},t,r,Lt),n=Fe(null==n?"":n);
+var e,u,r=Iu({},t.imports,r.imports,Lt),o=Ru(r),i=ge(r),a=0,r=t.interpolate||V,f="__p+='",r=Re((t.escape||V).source+"|"+r.source+"|"+(r===B?D:V).source+"|"+(t.evaluate||V).source+"|$","g");if(n.replace(r,function(t,r,o,i,c,l){return o||(o=i),f+=n.slice(a,l).replace(X,p),r&&(e=true,f+="'+__e("+r+")+'"),c&&(u=true,f+="';"+c+";\n__p+='"),o&&(f+="'+((__t=("+o+"))==null?'':__t)+'"),a=l+t.length,t}),f+="';",(r=t.variable)||(f="with(obj){"+f+"}"),f=(u?f.replace(U,""):f).replace(T,"$1").replace(L,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(e?",__e=_.escape":"")+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}",r=de(function(){return Ie(o,"return "+f).apply(d,i)
+}),r.source=f,ae(r))throw r;return r},K.trim=me,K.trimLeft=function(n,t){return(n=null==n?"":Fe(n))?null==t?n.slice(g(n)):(t=Fe(t),n.slice(o(n,t))):n},K.trimRight=function(n,t){return(n=null==n?"":Fe(n))?null==t?n.slice(0,v(n)+1):(t=Fe(t),n.slice(0,i(n,t)+1)):n},K.trunc=function(n,t){var r=30,e="...";if(ce(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Fe(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Fe(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e;
+if(r=n.slice(0,o),null==u)return r+e;if(se(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Re(u.source,(M.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Ht(K,function(n,t){var r="sample"!=t;K.prototype[t]||(K.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new G(o,u):o})}),K.VERSION=_,K.prototype.chain=function(){return this.__chain__=true,this},K.prototype.toJSON=Br,K.prototype.toString=function(){return Fe(this.__wrapped__)
+},K.prototype.value=Br,K.prototype.valueOf=Br,Et(["join","pop","shift"],function(n){var t=Te[n];K.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new G(r,n):r}}),Et(["push","reverse","sort","unshift"],function(n){var t=Te[n];K.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Et(["concat","splice"],function(n){var t=Te[n];K.prototype[n]=function(){return new G(t.apply(this.__wrapped__,arguments),this.__chain__)}}),_u.spliceObjects||Et(["pop","shift","splice"],function(n){var t=Te[n],r="splice"==n;
+K.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new G(u,n):u}}),K}var d,_="3.0.0-pre",b=1,w=2,j=4,A=8,x=16,E=32,O=64,I="__lodash@"+_+"__",C="Expected a function",S=Math.pow(2,32)-1,k=Math.pow(2,53)-1,R=0,F=/^[A-Z]+$/,U=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,L=/(__e\(.*?\)|\b__t\))\+'';/g,W=/&(?:amp|lt|gt|quot|#39|#96);/g,N=/[&<>"'`]/g,P=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,Z=/^\[object .+?Constructor\]$/,K=/[\xC0-\xFF]/g,V=/($^)/,Y=/[.*+?^${}()|[\]\/\\]/g,J=/\bthis\b/,X=/['\n\r\u2028\u2029\\]/g,G=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,H=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Q="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),nt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Error]",it="[object Function]",at="[object Number]",ft="[object Object]",ct="[object RegExp]",lt="[object String]",st="[object ArrayBuffer]",pt="[object Float32Array]",ht="[object Float64Array]",gt="[object Int8Array]",vt="[object Int16Array]",yt="[object Int32Array]",mt="[object Uint8Array]",dt="[object Uint8ClampedArray]",_t="[object Uint16Array]",bt="[object Uint32Array]",wt={};
+wt[tt]=wt[rt]=wt[pt]=wt[ht]=wt[gt]=wt[vt]=wt[yt]=wt[mt]=wt[dt]=wt[_t]=wt[bt]=true,wt[st]=wt[et]=wt[ut]=wt[ot]=wt[it]=wt["[object Map]"]=wt[at]=wt[ft]=wt[ct]=wt["[object Set]"]=wt[lt]=wt["[object WeakMap]"]=false;var jt={};jt[tt]=jt[rt]=jt[st]=jt[et]=jt[ut]=jt[pt]=jt[ht]=jt[gt]=jt[vt]=jt[yt]=jt[at]=jt[ft]=jt[ct]=jt[lt]=jt[mt]=jt[dt]=jt[_t]=jt[bt]=true,jt[ot]=jt[it]=jt["[object Map]"]=jt["[object Set]"]=jt["[object WeakMap]"]=false;var At={leading:false,maxWait:0,trailing:false},xt={configurable:false,enumerable:false,value:null,writable:false},Et={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ot={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},It={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},Ct={"function":true,object:true},St={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},kt=Ct[typeof window]&&window||this,Rt=Ct[typeof exports]&&exports&&!exports.nodeType&&exports,Ct=Ct[typeof module]&&module&&!module.nodeType&&module,Ft=Rt&&Ct&&typeof global=="object"&&global;
+!Ft||Ft.global!==Ft&&Ft.window!==Ft&&Ft.self!==Ft||(kt=Ft);var Ft=Ct&&Ct.exports===Rt&&Rt,Ut=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(kt._=Ut, define(function(){return Ut})):Rt&&Ct?Ft?(Ct.exports=Ut)._=Ut:Rt._=Ut:kt._=Ut}).call(this);
\ No newline at end of file
diff --git a/dist/lodash.js b/dist/lodash.js
index 0061afdeb..6dd402453 100644
--- a/dist/lodash.js
+++ b/dist/lodash.js
@@ -116,10 +116,10 @@
/** Used to assign default `context` object properties */
var contextProps = [
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
- 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', 'Object',
- 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN',
- 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', 'Uint8ClampedArray',
- 'Uint16Array', 'Uint32Array', 'window', 'WinRTError'
+ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
+ 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document',
+ 'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'window', 'WinRTError'
];
/** Used to make template sourceURLs easier to identify */
@@ -567,7 +567,7 @@
/*--------------------------------------------------------------------------*/
/**
- * Create a new `lodash` function using the given `context` object.
+ * Create a new pristine `lodash` function using the given `context` object.
*
* @static
* @memberOf _
@@ -576,19 +576,22 @@
* @returns {Function} Returns a new `lodash` function.
* @example
*
+ * _.mixin({ 'add': function(a, b) { return a + b; } }, false);
+ *
* var lodash = _.runInContext();
+ * lodash.mixin({ 'sub': function(a, b) { return a - b; } }, false);
*
- * lodash.mixin({
- * 'exists': function(value) {
- * return value != null;
- * }
- * }, false);
- *
- * _.isFunction(lodash.exists);
+ * _.isFunction(_.add);
* // => true
*
- * _.isFunction(_.exists);
+ * _.isFunction(_.sub);
* // => false
+ *
+ * lodash.isFunction(lodash.add);
+ * // => false
+ *
+ * lodash.isFunction(lodash.sub);
+ * // => true
*/
function runInContext(context) {
// Avoid issues with some ES3 environments that attempt to use values, named
@@ -1036,7 +1039,7 @@
* @param {Array} array The array to iterate over.
* @param {Function} iterator The function called per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initFromArray=false] Specify using the first element of
+ * @param {boolean} [initFromArray=false] Specify using the last element of
* `array` as the initial value.
* @returns {*} Returns the accumulated value.
*/
@@ -1142,51 +1145,57 @@
* @returns {Function} Returns the new function.
*/
function baseCallback(func, thisArg, argCount) {
- if (typeof func != 'function') {
+ var type = typeof func;
+
+ if (type == 'function') {
+ if (typeof thisArg == 'undefined') {
+ return func;
+ }
+ var data = func[EXPANDO];
+ if (typeof data == 'undefined') {
+ if (support.funcNames) {
+ data = !func.name;
+ }
+ data = data || !support.funcDecomp;
+ if (!data) {
+ var source = fnToString.call(func);
+ if (!support.funcNames) {
+ data = !reFuncName.test(source);
+ }
+ if (!data) {
+ // checks if `func` references the `this` keyword and stores the result
+ data = reThis.test(source) || isNative(func);
+ setData(func, data);
+ }
+ }
+ }
+ // exit early if there are no `this` references or `func` is bound
+ if (data === false || (data !== true && data[1] & BIND_FLAG)) {
+ return func;
+ }
+ switch (argCount) {
+ case 1: return function(value) {
+ return func.call(thisArg, value);
+ };
+ case 3: return function(value, index, collection) {
+ return func.call(thisArg, value, index, collection);
+ };
+ case 4: return function(accumulator, value, index, collection) {
+ return func.call(thisArg, accumulator, value, index, collection);
+ };
+ case 5: return function(value, other, key, object, source) {
+ return func.call(thisArg, value, other, key, object, source);
+ };
+ }
+ return function() {
+ return func.apply(thisArg, arguments);
+ };
+ }
+ if (func == null) {
return identity;
}
- if (typeof thisArg == 'undefined') {
- return func;
- }
- var data = func[EXPANDO];
- if (typeof data == 'undefined') {
- if (support.funcNames) {
- data = !func.name;
- }
- data = data || !support.funcDecomp;
- if (!data) {
- var source = fnToString.call(func);
- if (!support.funcNames) {
- data = !reFuncName.test(source);
- }
- if (!data) {
- // checks if `func` references the `this` keyword and stores the result
- data = reThis.test(source) || isNative(func);
- setData(func, data);
- }
- }
- }
- // exit early if there are no `this` references or `func` is bound
- if (data === false || (data !== true && data[1] & BIND_FLAG)) {
- return func;
- }
- switch (argCount) {
- case 1: return function(value) {
- return func.call(thisArg, value);
- };
- case 3: return function(value, index, collection) {
- return func.call(thisArg, value, index, collection);
- };
- case 4: return function(accumulator, value, index, collection) {
- return func.call(thisArg, accumulator, value, index, collection);
- };
- case 5: return function(value, other, key, object, source) {
- return func.call(thisArg, value, other, key, object, source);
- };
- }
- return function() {
- return func.apply(thisArg, arguments);
- };
+ // handle "_.pluck" and "_.where" style callback shorthands
+ return type == 'object' ? matches(func) : property(func);
}
/**
@@ -1257,7 +1266,7 @@
case float32Class: case float64Class:
case int8Class: case int16Class: case int32Class:
case uint8Class: case uint8ClampedClass: case uint16Class: case uint32Class:
- return new Ctor(cloneBuffer(value.buffer));
+ return new Ctor(cloneBuffer(value.buffer), value.byteOffset, value.length);
case numberClass:
case stringClass:
@@ -1446,7 +1455,7 @@
}
var index = -1,
indexOf = getIndexOf(),
- prereq = indexOf === baseIndexOf,
+ prereq = indexOf == baseIndexOf,
isLarge = prereq && createCache && values && values.length >= 200,
isCommon = prereq && !isLarge,
result = [],
@@ -2141,7 +2150,7 @@
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iterator The function called per iteration.
* @param {*} accumulator The initial value.
- * @param {boolean} initFromCollection Specify using the first element
+ * @param {boolean} initFromCollection Specify using the first or last element
* of `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
@@ -2212,18 +2221,14 @@
*
* @private
* @param {Array} array The array to inspect.
- * @param {boolean} [isSorted=false] Specify the array is sorted.
* @param {Function} [iterator] The function called per iteration.
* @returns {Array} Returns the new duplicate-value-free array.
*/
- function baseUniq(array, isSorted, iterator) {
- var length = array ? array.length : 0;
- if (!length) {
- return [];
- }
+ function baseUniq(array, iterator) {
var index = -1,
indexOf = getIndexOf(),
- prereq = !isSorted && indexOf === baseIndexOf,
+ length = array.length,
+ prereq = indexOf == baseIndexOf,
isLarge = prereq && createCache && length >= 200,
isCommon = prereq && !isLarge,
result = [];
@@ -2232,7 +2237,7 @@
var seen = createCache();
indexOf = cacheIndexOf;
} else {
- seen = (iterator && !isSorted) ? [] : result;
+ seen = iterator ? [] : result;
}
outer:
while (++index < length) {
@@ -2251,12 +2256,6 @@
}
result.push(value);
}
- else if (isSorted) {
- if (!index || seen !== computed) {
- seen = computed;
- result.push(value);
- }
- }
else if (indexOf(seen, computed) < 0) {
if (iterator || isLarge) {
seen.push(computed);
@@ -2366,7 +2365,7 @@
function createAggregator(setter, initializer) {
return function(collection, iterator, thisArg) {
var result = initializer ? initializer() : {};
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
if (isArray(collection)) {
var index = -1,
@@ -2643,6 +2642,21 @@
return baseCreateWrapper([func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]);
}
+ /**
+ * Gets the appropriate "callback" function. If the `_.callback` method is
+ * customized this function returns the custom method, otherwise it returns
+ * the `baseCallback` function. If arguments are provided the chosen function
+ * is executed with the arguments and its result is returned.
+ *
+ * @private
+ * @returns {Function} Returns the chosen function or its result.
+ */
+ function getCallback(func, thisArg, argCount) {
+ var result = lodash.callback || callback;
+ result = result === callback ? baseCallback : result;
+ return arguments.length ? result(func, thisArg, argCount) : result;
+ }
+
/**
* Finds the indexes of all placeholder elements in `array`.
*
@@ -2666,14 +2680,16 @@
/**
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is
* customized this function returns the custom method, otherwise it returns
- * the `baseIndexOf` function.
+ * the `baseIndexOf` function. If arguments are provided the chosen function
+ * is executed with the arguments and its result is returned.
*
* @private
- * @returns {Function} Returns the "indexOf" function.
+ * @returns {Function|number} Returns the chosen function or its result.
*/
- function getIndexOf() {
+ function getIndexOf(collection, target, fromIndex) {
var result = lodash.indexOf || indexOf;
- return result === indexOf ? baseIndexOf : result;
+ result = result === indexOf ? baseIndexOf : result;
+ return collection ? result(collection, target, fromIndex) : result;
}
/**
@@ -2702,6 +2718,18 @@
: (value && type == 'object' && reHostCtor.test(toString.call(value))) || false;
}
+ /**
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
+ * equality comparisons, else `false`.
+ */
+ function isStrictComparable(value) {
+ return value === value && (value === 0 ? (1 / value > 0) : !isObject(value));
+ }
+
/**
* Creates a clone of the given array buffer.
*
@@ -2805,6 +2833,33 @@
return result;
}
+ /**
+ * An implementation of `_.uniq` optimized for sorted arrays without support
+ * for callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iterator] The function called per iteration.
+ * @returns {Array} Returns the new duplicate-value-free array.
+ */
+ function sortedUniq(array, iterator) {
+ var seen,
+ index = -1,
+ length = array.length,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index],
+ computed = iterator ? iterator(value, index, array) : value;
+
+ if (!index || seen !== computed) {
+ seen = computed;
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
/**
* Converts `collection` to an array if it is not an array-like value.
*
@@ -3016,7 +3071,7 @@
var length = array ? array.length : 0,
index = length;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (index-- && predicate(array[index], index, array)) { }
return slice(array, 0, index + 1);
}
@@ -3064,7 +3119,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length && predicate(array[index], index, array)) { }
return slice(array, index);
}
@@ -3114,7 +3169,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length) {
if (predicate(array[index], index, array)) {
return index;
@@ -3167,7 +3222,7 @@
function findLastIndex(array, predicate, thisArg) {
var length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (length--) {
if (predicate(array[length], length, array)) {
return length;
@@ -3307,7 +3362,7 @@
argsLength = arguments.length,
caches = [],
indexOf = getIndexOf(),
- prereq = createCache && indexOf === baseIndexOf;
+ prereq = createCache && indexOf == baseIndexOf;
while (++argsIndex < argsLength) {
var value = arguments[argsIndex];
@@ -3511,7 +3566,7 @@
length = array ? array.length : 0,
result = [];
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
@@ -3626,7 +3681,7 @@
* // => 1
*/
function sortedIndex(array, value, iterator, thisArg) {
- iterator = iterator == null ? identity : lodash.callback(iterator, thisArg, 1);
+ iterator = iterator == null ? identity : getCallback(iterator, thisArg, 1);
return baseSortedIndex(array, value, iterator);
}
@@ -3652,7 +3707,7 @@
* // => 4
*/
function sortedLastIndex(array, value, iterator, thisArg) {
- iterator = iterator == null ? identity : lodash.callback(iterator, thisArg, 1);
+ iterator = iterator == null ? identity : getCallback(iterator, thisArg, 1);
return baseSortedIndex(array, value, iterator, true);
}
@@ -3761,7 +3816,7 @@
var length = array ? array.length : 0,
index = length;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (index-- && predicate(array[index], index, array)) { }
return slice(array, index + 1);
}
@@ -3809,7 +3864,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
while (++index < length && predicate(array[index], index, array)) { }
return slice(array, 0, index);
}
@@ -3893,9 +3948,11 @@
}
}
if (iterator != null) {
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
}
- return baseUniq(array, isSorted, iterator);
+ return (isSorted && getIndexOf() == baseIndexOf)
+ ? sortedUniq(array, iterator)
+ : baseUniq(array, iterator);
}
/**
@@ -4000,7 +4057,7 @@
/**
* Creates an object composed from arrays of property names and values. Provide
- * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+ * either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]`
* or two arrays, one of property names and one of corresponding values.
*
* @static
@@ -4233,8 +4290,7 @@
? nativeContains.call(collection, target, fromIndex)
: collection.indexOf(target, fromIndex) > -1;
}
- var indexOf = getIndexOf();
- return indexOf(collection, target, fromIndex) > -1;
+ return getIndexOf(collection, target, fromIndex) > -1;
}
/**
@@ -4318,7 +4374,7 @@
*/
function every(collection, predicate, thisArg) {
if (typeof predicate != 'function' || typeof thisArg != 'undefined') {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
}
var func = isArray(collection) ? arrayEvery : baseEvery;
return func(collection, predicate);
@@ -4365,7 +4421,7 @@
* // => [{ 'name': 'barney', 'age': 36 }]
*/
function filter(collection, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, predicate);
@@ -4419,7 +4475,7 @@
var index = findIndex(collection, predicate, thisArg);
return index > -1 ? collection[index] : undefined;
}
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(collection, predicate, baseEach);
}
@@ -4442,7 +4498,7 @@
* // => 3
*/
function findLast(collection, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(collection, predicate, baseEachRight);
}
@@ -4681,7 +4737,7 @@
* // => ['barney', 'fred']
*/
function map(collection, iterator, thisArg) {
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
var func = isArray(collection) ? arrayMap : baseMap;
return func(collection, iterator);
@@ -4739,20 +4795,25 @@
if ((type == 'number' || type == 'string') && thisArg && thisArg[iterator] === collection) {
iterator = null;
}
- if (iterator == null && isArray(collection)) {
+ var noIterator = iterator == null,
+ isArr = noIterator && isArray(collection),
+ isStr = !isArr && isString(collection);
+
+ if (noIterator && !isStr) {
var index = -1,
- length = collection.length;
+ iterable = toIterable(collection),
+ length = iterable.length;
while (++index < length) {
- var value = collection[index];
+ var value = iterable[index];
if (value > result) {
result = value;
}
}
} else {
- iterator = (iterator == null && isString(collection))
+ iterator = (noIterator && isStr)
? charAtCallback
- : lodash.callback(iterator, thisArg, 3);
+ : getCallback(iterator, thisArg, 3);
baseEach(collection, function(value, index, collection) {
var current = iterator(value, index, collection);
@@ -4817,20 +4878,25 @@
if ((type == 'number' || type == 'string') && thisArg && thisArg[iterator] === collection) {
iterator = null;
}
- if (iterator == null && isArray(collection)) {
+ var noIterator = iterator == null,
+ isArr = noIterator && isArray(collection),
+ isStr = !isArr && isString(collection);
+
+ if (noIterator && !isStr) {
var index = -1,
- length = collection.length;
+ iterable = toIterable(collection),
+ length = iterable.length;
while (++index < length) {
- var value = collection[index];
+ var value = iterable[index];
if (value < result) {
result = value;
}
}
} else {
- iterator = (iterator == null && isString(collection))
+ iterator = (noIterator && isStr)
? charAtCallback
- : lodash.callback(iterator, thisArg, 3);
+ : getCallback(iterator, thisArg, 3);
baseEach(collection, function(value, index, collection) {
var current = iterator(value, index, collection);
@@ -4944,7 +5010,7 @@
*/
function reduce(collection, iterator, accumulator, thisArg) {
var func = isArray(collection) ? arrayReduce : baseReduce;
- return func(collection, lodash.callback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEach);
+ return func(collection, getCallback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEach);
}
/**
@@ -4968,7 +5034,7 @@
*/
function reduceRight(collection, iterator, accumulator, thisArg) {
var func = isArray(collection) ? arrayReduceRight : baseReduce;
- return func(collection, lodash.callback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEachRight);
+ return func(collection, getCallback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEachRight);
}
/**
@@ -5010,7 +5076,7 @@
* // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
*/
function reject(collection, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return filter(collection, negate(predicate));
}
@@ -5147,7 +5213,7 @@
*/
function some(collection, predicate, thisArg) {
if (typeof predicate != 'function' || typeof thisArg != 'undefined') {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
}
var func = isArray(collection) ? arraySome : baseSome;
return func(collection, predicate);
@@ -5212,7 +5278,7 @@
result.length = length;
}
if (!multi) {
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
}
baseEach(collection, function(value, key, collection) {
if (multi) {
@@ -6308,7 +6374,7 @@
* // => 'fred'
*/
function findKey(object, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(object, predicate, baseForOwn, true);
}
@@ -6354,7 +6420,7 @@
* // => 'pebbles'
*/
function findLastKey(object, predicate, thisArg) {
- predicate = lodash.callback(predicate, thisArg, 3);
+ predicate = getCallback(predicate, thisArg, 3);
return baseFind(object, predicate, baseForOwnRight, true);
}
@@ -6560,7 +6626,7 @@
}
/**
- * Checks if `value` is an `arguments` object.
+ * Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
@@ -6581,13 +6647,13 @@
}
/**
- * Checks if `value` is an array.
+ * Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -6602,13 +6668,13 @@
};
/**
- * Checks if `value` is a boolean value.
+ * Checks if `value` is classified as a boolean primitive or object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a boolean value, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isBoolean(false);
@@ -6623,13 +6689,13 @@
}
/**
- * Checks if `value` is a `Date` object.
+ * Checks if `value` is classified as a `Date` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isDate(new Date);
@@ -6751,23 +6817,9 @@
*/
function isEqual(value, other, customizer, thisArg) {
customizer = typeof customizer == 'function' && baseCallback(customizer, thisArg, 3);
-
- if (!customizer) {
- // exit early for identical values
- if (value === other) {
- // treat `-0` vs. `+0` as not equal
- return value !== 0 || (1 / value == 1 / other);
- }
- var valType = typeof value,
- othType = typeof other;
-
- // exit early for unlike primitive values
- if (value === value && (value == null || other == null ||
- (valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object'))) {
- return false;
- }
- }
- return baseIsEqual(value, other, customizer);
+ return (!customizer && isStrictComparable(value) && isStrictComparable(other))
+ ? value === other
+ : baseIsEqual(value, other, customizer);
}
/**
@@ -6792,7 +6844,7 @@
}
/**
- * Checks if `value` is a finite number.
+ * Checks if `value` is a finite primitive number.
*
* Note: This method is based on ES6 `Number.isFinite`. See the
* [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite)
@@ -6802,7 +6854,7 @@
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is finite, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* @example
*
* _.isFinite(10);
@@ -6825,13 +6877,13 @@
};
/**
- * Checks if `value` is a function.
+ * Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
@@ -6928,16 +6980,16 @@
}
/**
- * Checks if `value` is a `Number` primitive or object.
+ * Checks if `value` is classified as a `Number` primitive or object.
*
- * Note: `NaN` is considered a number. See the [ES5 spec](http://es5.github.io/#x8.5)
- * for more details.
+ * Note: To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
+ * as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a number, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isNumber(8.4);
@@ -6999,13 +7051,13 @@
};
/**
- * Checks if `value` is a `RegExp` object.
+ * Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a regexp object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -7019,13 +7071,13 @@
}
/**
- * Checks if `value` is a `String` primitive or object.
+ * Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
@@ -7180,7 +7232,7 @@
*/
function mapValues(object, iterator, thisArg) {
var result = {};
- iterator = lodash.callback(iterator, thisArg, 3);
+ iterator = getCallback(iterator, thisArg, 3);
baseForOwn(object, function(value, key, object) {
result[key] = iterator(value, key, object);
@@ -7273,7 +7325,7 @@
return {};
}
if (typeof predicate == 'function') {
- return basePick(object, negate(lodash.callback(predicate, thisArg, 3)));
+ return basePick(object, negate(getCallback(predicate, thisArg, 3)));
}
var omitProps = baseFlatten(arguments, false, false, 1);
return basePick(Object(object), baseDifference(keysIn(object), arrayMap(omitProps, String)));
@@ -7281,7 +7333,7 @@
/**
* Creates a two dimensional array of a given object's key-value pairs,
- * i.e. `[[key1, value1], [key2, value2]]`.
+ * e.g. `[[key1, value1], [key2, value2]]`.
*
* @static
* @memberOf _
@@ -7339,7 +7391,7 @@
}
return basePick(Object(object),
typeof predicate == 'function'
- ? lodash.callback(predicate, thisArg, 3)
+ ? getCallback(predicate, thisArg, 3)
: baseFlatten(arguments, false, false, 1)
);
}
@@ -7390,7 +7442,7 @@
}
}
if (iterator) {
- iterator = lodash.callback(iterator, thisArg, 4);
+ iterator = getCallback(iterator, thisArg, 4);
(isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
return iterator(accumulator, value, index, object);
});
@@ -7550,7 +7602,11 @@
* // => 'fred, barney, & pebbles'
*/
function escape(string) {
- return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+ // reset `lastIndex` because in IE < 9 `String#replace` does not
+ string = string == null ? '' : String(string);
+ return (reUnescapedHtml.lastIndex = 0, reUnescapedHtml.test(string))
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
+ : string;
}
/**
@@ -7568,7 +7624,10 @@
* // => '\[lodash\]\(http://lodash\.com\)'
*/
function escapeRegExp(string) {
- return string == null ? '' : String(string).replace(reRegExpChars, '\\$&');
+ string = string == null ? '' : String(string);
+ return (reRegExpChars.lastIndex = 0, reRegExpChars.test(string))
+ ? string.replace(reRegExpChars, '\\$&')
+ : string;
}
/**
@@ -7719,6 +7778,9 @@
return result;
}
string = String(string);
+
+ // leverage the exponentiation by squaring algorithm for a faster repeat
+ // http://en.wikipedia.org/wiki/Exponentiation_by_squaring
do {
if (n % 2) {
result += string;
@@ -7789,7 +7851,7 @@
* properties may be accessed as free variables in the template. If a setting
* object is provided it overrides `_.templateSettings` for the template.
*
- * Note: In the development build, `_.template` utilizes sourceURLs 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.
*
@@ -7828,22 +7890,27 @@
* compiled({ 'people': ['fred', 'barney'] });
* // => 'fredbarney'
*
- * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
- * var compiled = _.template('hello ${ name }');
- * compiled({ 'name': 'pebbles' });
- * // => 'hello pebbles'
- *
* // using the internal `print` function in "evaluate" delimiters
* var compiled = _.template('<% print("hello " + name); %>!');
* compiled({ 'name': 'barney' });
* // => 'hello barney!'
*
- * // using a custom template delimiters
+ * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+ * var compiled = _.template('hello ${ name }');
+ * compiled({ 'name': 'pebbles' });
+ * // => 'hello pebbles'
+ *
+ * // using custom template delimiters
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ name }}!');
* compiled({ 'name': 'mustache' });
* // => 'hello mustache!'
*
+ * // using backslashes to treat delimiters as plain text
+ * var compiled = _.template('<%= "\\<%- value %\\>" %>');
+ * compiled({ 'value': 'ignored' });
+ * // => '<%- value %>'
+ *
* // using the `imports` option to import `jQuery` as `jq`
* var text = '<% jq.each(people, function(name) { %><%- name %><% }); %>';
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
@@ -8159,11 +8226,10 @@
* // => 'fred, barney & pebbles'
*/
function unescape(string) {
- if (string == null) {
- return '';
- }
- string = String(string);
- return string.indexOf(';') < 0 ? string : string.replace(reEscapedHtml, unescapeHtmlChar);
+ string = string == null ? '' : String(string);
+ return (reEscapedHtml.lastIndex = 0, reEscapedHtml.test(string))
+ ? string.replace(reEscapedHtml, unescapeHtmlChar)
+ : string;
}
/*--------------------------------------------------------------------------*/
@@ -8207,7 +8273,6 @@
* @category Utility
* @param {*} [func=identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of the created callback.
- * @param {number} [argCount] The number of arguments the callback accepts.
* @returns {Function} Returns the new function.
* @example
*
@@ -8217,9 +8282,12 @@
* ];
*
* // wrap to create custom callback shorthands
- * _.callback = _.wrap(_.callback, function(func, callback, thisArg) {
- * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
- * return !match ? func(callback, thisArg) : function(object) {
+ * _.callback = _.wrap(_.callback, function(callback, func, thisArg) {
+ * var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
+ * if (!match) {
+ * return callback(func, thisArg);
+ * }
+ * return function(object) {
* return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
* };
* });
@@ -8227,18 +8295,8 @@
* _.filter(characters, 'age__gt38');
* // => [{ 'name': 'fred', 'age': 40 }]
*/
- function callback(func, thisArg, argCount) {
- var type = typeof func,
- isFunc = type == 'function';
-
- if (isFunc && typeof thisArg == 'undefined') {
- return func;
- }
- if (isFunc || func == null) {
- return baseCallback(func, thisArg, argCount);
- }
- // handle "_.pluck" and "_.where" style callback shorthands
- return type == 'object' ? matches(func) : property(func);
+ function callback(func, thisArg) {
+ return baseCallback(func, thisArg);
}
/**
@@ -8307,17 +8365,28 @@
*/
function matches(source) {
var props = keys(source),
- length = props.length,
- index = length,
- modes = Array(length),
+ length = props.length;
+
+ if (length == 1) {
+ var key = props[0],
+ value = source[key];
+
+ if (isStrictComparable(value)) {
+ return function(object) {
+ return object != null && value === object[key] && hasOwnProperty.call(object, key);
+ };
+ }
+ }
+ var index = length,
+ flags = Array(length),
vals = Array(length);
while (index--) {
- var value = source[props[index]],
- isDeep = value !== value || (value === 0 && 1 / value < 0) || isObject(value);
+ value = source[props[index]];
+ var isStrict = isStrictComparable(value);
- modes[index] = isDeep;
- vals[index] = isDeep ? baseClone(value, isDeep) : value;
+ flags[index] = isStrict;
+ vals[index] = isStrict ? value : baseClone(value, false);
}
return function(object) {
index = length;
@@ -8325,13 +8394,13 @@
return !index;
}
while (index--) {
- if (modes[index] ? !hasOwnProperty.call(object, props[index]) : vals[index] !== object[props[index]]) {
+ if (flags[index] ? vals[index] !== object[props[index]] : !hasOwnProperty.call(object, props[index])) {
return false;
}
}
index = length;
while (index--) {
- if (modes[index] ? !baseIsEqual(vals[index], object[props[index]], null, true) : !hasOwnProperty.call(object, props[index])) {
+ if (flags[index] ? !hasOwnProperty.call(object, props[index]) : !baseIsEqual(vals[index], object[props[index]], null, true)) {
return false;
}
}
diff --git a/dist/lodash.min.js b/dist/lodash.min.js
index 407824530..deb007571 100644
--- a/dist/lodash.min.js
+++ b/dist/lodash.min.js
@@ -4,66 +4,66 @@
* Build: `lodash modern -o ./dist/lodash.js`
*/
;(function(){function n(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202i(t,a)&&c.push(a);return c}function Dt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>R)return Jt(n,t);for(var e=-1,u=xr(n);++e=r||r>R)return Xt(n,t);for(var e=xr(n);r--&&false!==t(e[r],r,n););return n
-}function zt(n,t){var r=true;return Dt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function qt(n,t){var r=[];return Dt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Pt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Zt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,f=r(n[i]);(e?f<=t:ff(p,h)&&((u||c)&&p.push(h),l.push(s))}return l}function cr(n,t){for(var r=-1,e=t(n),u=e.length,o=me(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?eu(u+e,0):e||0;else if(e)return e=Sr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Ir(n){return Rr(n,1)}function Rr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=eu(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=eu(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=me(u);++er?eu(e+r,0):r||0:0,typeof n=="string"||!bu(n)&&fe(n)?ro&&(o=f)}else t=null==t&&fe(n)?u:Z.callback(t,r,3),Dt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)
-});return o}function Pr(n,t){return zr(n,de(t))}function Zr(n,t,r,e){return(bu(n)?Et:or)(n,Z.callback(t,e,4),r,3>arguments.length,Dt)}function Kr(n,t,r,e){return(bu(n)?It:or)(n,Z.callback(t,e,4),r,3>arguments.length,Mt)}function Vr(n){n=xr(n);for(var t=-1,r=n.length,e=me(r);++t=r||r>t?(f&&Be(f),r=s,f=p=s=d,r&&(h=Ou(),a=n.apply(l,i),p||f||(i=l=null))):p=Ve(e,r)}function u(){p&&Be(p),f=p=s=d,(v||g!==t)&&(h=Ou(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Ou(),l=this,s=v&&(p||!y),false===g)var r=y&&!p;else{f||y||(h=c);var o=g-(c-h),d=0>=o||o>g;d?(f&&(f=Be(f)),h=c,a=n.apply(l,i)):f||(f=Ve(u,o))}return d&&p?p=Be(p):p||t===g||(p=Ve(e,t)),r&&(d=true,a=n.apply(l,i)),!d||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;
-if(!ee(n))throw new Oe(O);if(t=0>t?0:t,true===r)var y=true,v=false;else ue(r)&&(y=r.leading,g="maxWait"in r&&eu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){p&&Be(p),f&&Be(f),f=p=s=d},o}function Gr(n){if(!ee(n))throw new Oe(O);return function(){return!n.apply(this,arguments)}}function Hr(n){return rr(n,x,Rr(arguments,1))}function Qr(n){return Gt(n,ae)}function ne(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ne.call(n)==Q||false}function te(n){return n&&typeof n=="object"&&1===n.nodeType&&-1>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=me(r),f=0t||null==n||!tu(t))return r;n=Ee(n);do t%2&&(r+=n),t=Me(t/2),n+=n;while(t);return r}function se(n,t){return(n=null==n?"":Ee(n))?null==t?n.slice(h(n),g(n)+1):(t=Ee(t),n.slice(o(n,t),i(n,t)+1)):n}function he(n){try{return n()}catch(t){return re(t)?t:_e(t)}}function ge(n){return n}function ve(n){for(var t=ju(n),r=t.length,e=r,u=me(r),o=me(r);e--;){var i=n[t[e]],f=i!==i||0===i&&0>1/i||ue(i);
-u[e]=f,o[e]=f?Ut(i,f):i}return function(n){if(e=r,null==n)return!e;for(;e--;)if(u[e]?!qe.call(n,t[e]):o[e]!==n[t[e]])return false;for(e=r;e--;)if(u[e]?!Ht(o[e],n[t[e]],null,true):!qe.call(n,t[e]))return false;return true}}function ye(n,t,r){var e=true,u=t&&Gt(t,ju);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Gt(t,ju)),false===r?e=false:ue(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=ee(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},Z.assign=mu,Z.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1arguments.length?yr(n,b,null,t):rr(n,b|x,Rr(arguments,2),t)},Z.bindAll=function(n){for(var t=n,r=1arguments.length?yr(t,b|_,null,n):yr(t,b|_|x,null,n,Rr(arguments,2))},Z.callback=function(n,t,r){var e=typeof n,u="function"==e;return u&&typeof t=="undefined"?n:u||null==n?Nt(n,t,r):"object"==e?ve(n):de(n)},Z.chain=function(n){return n=Z(n),n.__chain__=true,n},Z.chunk=function(n,t){var r=0,e=n?n.length:0,u=[];for(t=eu(+t||1,1);rt?0:t)},Z.dropRight=function(n,t,r){var e=n?n.length:0;
-return t=e-((null==t||r?1:t)||0),Rr(n,0,0>t?0:t)},Z.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Z.callback(t,r,3);e--&&t(n[e],e,n););return Rr(n,0,e+1)},Z.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Z.callback(t,r,3);++e(s?e(s,a):i(p,a))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,a):i(n[t],a)))continue n}s&&s.push(a),p.push(a)}return p},Z.invert=function(n,t){for(var r=-1,e=ju(n),u=e.length,o={};++rt?0:t)},Z.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Rr(n,0>t?0:t)},Z.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Z.callback(t,r,3);e--&&t(n[e],e,n););return Rr(n,e+1)
-},Z.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Z.callback(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Z.escape=function(n){return null==n?"":Ee(n).replace(W,p)},Z.escapeRegExp=le,Z.every=Lr,Z.find=Br,Z.findIndex=kr,Z.findKey=function(n,t,r){return t=Z.callback(t,r,3),Pt(n,t,Jt,true)},Z.findLast=function(n,t,r){return t=Z.callback(t,r,3),Pt(n,t,Mt)},Z.findLastIndex=function(n,t,r){var e=n?n.length:0;
-for(t=Z.callback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Z.findLastKey=function(n,t,r){return t=Z.callback(t,r,3),Pt(n,t,Xt,true)},Z.findWhere=function(n,t){return Br(n,ve(t))},Z.first=Er,Z.has=function(n,t){return n?qe.call(n,t):false},Z.identity=ge,Z.indexOf=Or,Z.isArguments=ne,Z.isArray=bu,Z.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ne.call(n)==tt||false},Z.isDate=function(n){return n&&typeof n=="object"&&Ne.call(n)==rt||false},Z.isElement=te,Z.isEmpty=function(n){if(null==n)return true;
-var t=n.length;return typeof t=="number"&&-1r?eu(u+r,0):uu(r||0,u-1))+1;else if(r)return u=Cr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},Z.max=qr,Z.min=function(n,t,r){var e=1/0,o=e,i=typeof t;if("number"!=i&&"string"!=i||!r||r[t]!==n||(t=null),null==t&&bu(n))for(r=-1,i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Z.template=function(n,t){var r=Z.templateSettings;t=mu({},t,r,Ft),n=Ee(null==n?"":n);
-var e,u,r=mu({},t.imports,r.imports,Ft),o=ju(r),i=ce(r),f=0,r=t.interpolate||K,a="__p+='",r=ke((t.escape||K).source+"|"+r.source+"|"+(r===B?D:K).source+"|"+(t.evaluate||K).source+"|$","g");if(n.replace(r,function(t,r,o,i,c,l){return o||(o=i),a+=n.slice(f,l).replace(J,s),r&&(e=true,a+="'+__e("+r+")+'"),c&&(u=true,a+="';"+c+";\n__p+='"),o&&(a+="'+((__t=("+o+"))==null?'':__t)+'"),f=l+t.length,t}),a+="';",(r=t.variable)||(a="with(obj){"+a+"}"),a=(u?a.replace(F,""):a).replace(T,"$1").replace(N,"$1;"),a="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(e?",__e=_.escape":"")+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",r=he(function(){return we(o,"return "+a).apply(d,i)
-}),r.source=a,re(r))throw r;return r},Z.trim=se,Z.trimLeft=function(n,t){return(n=null==n?"":Ee(n))?null==t?n.slice(h(n)):(t=Ee(t),n.slice(o(n,t))):n},Z.trimRight=function(n,t){return(n=null==n?"":Ee(n))?null==t?n.slice(0,g(n)+1):(t=Ee(t),n.slice(0,i(n,t)+1)):n},Z.trunc=function(n,t){var r=30,e="...";if(ue(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Ee(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Ee(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e;
-if(r=n.slice(0,o),null==u)return r+e;if(ie(u)){if(n.slice(o).search(u)){var i,f,a=n.slice(0,o);for(u.global||(u=ke(u.source,(M.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(a);)f=i.index;r=r.slice(0,null==f?o:f)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(U,v))},Z.uniqueId=function(n){var t=++S;return Ee(null==n?"":n)+t},Z.all=Lr,Z.any=Yr,Z.detect=Br,Z.foldl=Zr,Z.foldr=Kr,Z.head=Er,Z.include=Wr,Z.inject=Zr,ye(Z,function(){var n={};
-return Jt(Z,function(t,r){Z.prototype[r]||(n[r]=t)}),n}(),false),Z.sample=function(n,t,r){n=xr(n);var e=n.length;return null==t||r?0t?0:+t||0,n.length),n)},Jt(Z,function(n,t){var r="sample"!=t;Z.prototype[t]||(Z.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new X(o,u):o})}),Z.VERSION=m,Z.prototype.chain=function(){return this.__chain__=true,this},Z.prototype.toJSON=Ur,Z.prototype.toString=function(){return Ee(this.__wrapped__)
-},Z.prototype.value=Ur,Z.prototype.valueOf=Ur,jt(["join","pop","shift"],function(n){var t=Ie[n];Z.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new X(r,n):r}}),jt(["push","reverse","sort","unshift"],function(n){var t=Ie[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),jt(["concat","splice"],function(n){var t=Ie[n];Z.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Z}var d,m="3.0.0-pre",b=1,_=2,w=4,j=8,A=16,x=32,k=64,E="__lodash@"+m+"__",O="Expected a function",I=Math.pow(2,32)-1,R=Math.pow(2,53)-1,S=0,C=/^[A-Z]+$/,F=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,U=/&(?:amp|lt|gt|quot|#39|#96);/g,W=/[&<>"'`]/g,L=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,P=/^\[object .+?Constructor\]$/,Z=/[\xC0-\xFF]/g,K=/($^)/,V=/[.*+?^${}()|[\]\/\\]/g,Y=/\bthis\b/,J=/['\n\r\u2028\u2029\\]/g,X=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,G=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",H="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),Q="[object Arguments]",nt="[object Array]",tt="[object Boolean]",rt="[object Date]",et="[object Error]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",ft="[object String]",at="[object ArrayBuffer]",ct="[object Float32Array]",lt="[object Float64Array]",pt="[object Int8Array]",st="[object Int16Array]",ht="[object Int32Array]",gt="[object Uint8Array]",vt="[object Uint8ClampedArray]",yt="[object Uint16Array]",dt="[object Uint32Array]",mt={};
-mt[Q]=mt[nt]=mt[ct]=mt[lt]=mt[pt]=mt[st]=mt[ht]=mt[gt]=mt[vt]=mt[yt]=mt[dt]=true,mt[at]=mt[tt]=mt[rt]=mt[et]=mt["[object Function]"]=mt["[object Map]"]=mt[ut]=mt[ot]=mt[it]=mt["[object Set]"]=mt[ft]=mt["[object WeakMap]"]=false;var bt={};bt[Q]=bt[nt]=bt[at]=bt[tt]=bt[rt]=bt[ct]=bt[lt]=bt[pt]=bt[st]=bt[ht]=bt[ut]=bt[ot]=bt[it]=bt[ft]=bt[gt]=bt[vt]=bt[yt]=bt[dt]=true,bt[et]=bt["[object Function]"]=bt["[object Map]"]=bt["[object Set]"]=bt["[object WeakMap]"]=false;var _t={leading:false,maxWait:0,trailing:false},wt={configurable:false,enumerable:false,value:null,writable:false},jt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},At={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},xt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},kt={"function":true,object:true},Et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ot=kt[typeof window]&&window||this,It=kt[typeof exports]&&exports&&!exports.nodeType&&exports,kt=kt[typeof module]&&module&&!module.nodeType&&module,Rt=It&&kt&&typeof global=="object"&&global;
-!Rt||Rt.global!==Rt&&Rt.window!==Rt&&Rt.self!==Rt||(Ot=Rt);var Rt=kt&&kt.exports===It&&It,St=y();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ot._=St, define(function(){return St})):It&&kt?Rt?(kt.exports=St)._=St:It._=St:Ot._=St}).call(this);
\ No newline at end of file
+}function f(n,r){return t(n.a,r.a)||n.b-r.b}function a(n,r){for(var e=-1,u=n.a,o=r.a,i=u.length;++ee||13e||8202r||13r||8202i(t,a)&&c.push(a);return c}function Dt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>R)return Jt(n,t);for(var e=-1,u=Ir(n);++e=r||r>R)return Xt(n,t);for(var e=Ir(n);r--&&false!==t(e[r],r,n););return n}function zt(n,t){var r=true;return Dt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function qt(n,t){var r=[];return Dt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Pt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Zt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,f=r(n[i]);(e?f<=t:fo(l,s)&&((t||a)&&l.push(s),c.push(p))}return c}function cr(n,t){for(var r=-1,e=t(n),u=e.length,o=we(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?iu(u+e,0):e||0;else if(e)return e=Fr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Sr(n){return Cr(n,1)}function Cr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=iu(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=iu(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=we(u);++er?iu(e+r,0):r||0:0,typeof n=="string"||!ju(n)&&ce(n)?ro&&(o=f);else t=i&&f?u:dr(t,r,3),Dt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)});return o}function Kr(n,t){return Pr(n,be(t))
+}function Vr(n,t,r,e){return(ju(n)?It:or)(n,dr(t,e,4),r,3>arguments.length,Dt)}function Yr(n,t,r,e){return(ju(n)?kt:or)(n,dr(t,e,4),r,3>arguments.length,Mt)}function Jr(n){n=Ir(n);for(var t=-1,r=n.length,e=we(r);++t=r||r>t?(f&&ze(f),r=s,f=p=s=d,r&&(h=Su(),a=n.apply(l,i),p||f||(i=l=null))):p=Xe(e,r)}function u(){p&&ze(p),f=p=s=d,(v||g!==t)&&(h=Su(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Su(),l=this,s=v&&(p||!y),false===g)var r=y&&!p;else{f||y||(h=c);var o=g-(c-h),d=0>=o||o>g;d?(f&&(f=ze(f)),h=c,a=n.apply(l,i)):f||(f=Xe(u,o))}return d&&p?p=ze(p):p||t===g||(p=Xe(e,t)),r&&(d=true,a=n.apply(l,i)),!d||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;if(!oe(n))throw new Se(O);if(t=0>t?0:t,true===r)var y=true,v=false;
+else ie(r)&&(y=r.leading,g="maxWait"in r&&iu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){p&&ze(p),f&&ze(f),f=p=s=d},o}function Qr(n){if(!oe(n))throw new Se(O);return function(){return!n.apply(this,arguments)}}function ne(n){return rr(n,x,Cr(arguments,1))}function te(n){return Gt(n,le)}function re(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Le.call(n)==Q||false}function ee(n){return n&&typeof n=="object"&&1===n.nodeType&&-1>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=we(r),f=0t||null==n||!uu(t))return r;n=Re(n);do t%2&&(r+=n),t=Pe(t/2),n+=n;while(t);return r}function ge(n,t){return(n=null==n?"":Re(n))?null==t?n.slice(h(n),g(n)+1):(t=Re(t),n.slice(o(n,t),i(n,t)+1)):n}function ve(n){try{return n()}catch(t){return ue(t)?t:Ae(t)}}function ye(n,t){return Ut(n,t)
+}function de(n){return n}function me(n){var t=Eu(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(jr(u))return function(n){return null!=n&&u===n[e]&&Ke.call(n,e)}}for(var o=r,i=we(r),f=we(r);o--;){var u=n[t[o]],a=jr(u);i[o]=a,f[o]=a?u:Wt(u,false)}return function(n){if(o=r,null==n)return!o;for(;o--;)if(i[o]?f[o]!==n[t[o]]:!Ke.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!Ke.call(n,t[o]):!Ht(f[o],n[t[o]],null,true))return false;return true}}function _e(n,t,r){var e=true,u=t&&Gt(t,Eu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Gt(t,Eu)),false===r?e=false:ie(r)&&"chain"in r&&(e=r.chain),r=-1;
+for(var o=oe(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},Z.assign=wu,Z.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1arguments.length?yr(n,_,null,t):rr(n,_|x,Cr(arguments,2),t)},Z.bindAll=function(n){for(var t=n,r=1arguments.length?yr(t,_|b,null,n):yr(t,_|b|x,null,n,Cr(arguments,2))},Z.callback=ye,Z.chain=function(n){return n=Z(n),n.__chain__=true,n},Z.chunk=function(n,t){var r=0,e=n?n.length:0,u=[];for(t=iu(+t||1,1);rt?0:t)},Z.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Cr(n,0,0>t?0:t)},Z.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=dr(t,r,3);e--&&t(n[e],e,n););return Cr(n,0,e+1)
+},Z.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=dr(t,r,3);++e(s?e(s,a):i(p,a))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,a):i(n[t],a)))continue n
+}s&&s.push(a),p.push(a)}return p},Z.invert=function(n,t){for(var r=-1,e=Eu(n),u=e.length,o={};++rt?0:t)},Z.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Cr(n,0>t?0:t)},Z.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=dr(t,r,3);e--&&t(n[e],e,n););return Cr(n,e+1)},Z.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=dr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Z.escape=function(n){return n=null==n?"":Re(n),N.lastIndex=0,N.test(n)?n.replace(N,p):n
+},Z.escapeRegExp=se,Z.every=Br,Z.find=Mr,Z.findIndex=Or,Z.findKey=function(n,t,r){return t=dr(t,r,3),Pt(n,t,Jt,true)},Z.findLast=function(n,t,r){return t=dr(t,r,3),Pt(n,t,Mt)},Z.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=dr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Z.findLastKey=function(n,t,r){return t=dr(t,r,3),Pt(n,t,Xt,true)},Z.findWhere=function(n,t){return Mr(n,me(t))},Z.first=kr,Z.has=function(n,t){return n?Ke.call(n,t):false},Z.identity=de,Z.indexOf=Rr,Z.isArguments=re,Z.isArray=ju,Z.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Le.call(n)==tt||false
+},Z.isDate=function(n){return n&&typeof n=="object"&&Le.call(n)==rt||false},Z.isElement=ee,Z.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?iu(u+r,0):fu(r||0,u-1))+1;else if(r)return u=Tr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},Z.max=Zr,Z.min=function(n,t,r){var e=1/0,o=e,i=typeof t;"number"!=i&&"string"!=i||!r||r[t]!==n||(t=null);var i=null==t,f=!(i&&ju(n))&&ce(n);if(i&&!f)for(r=-1,n=Ir(n),i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Z.template=function(n,t){var r=Z.templateSettings;t=wu({},t,r,Ft),n=Re(null==n?"":n);
+var e,u,r=wu({},t.imports,r.imports,Ft),o=Eu(r),i=pe(r),f=0,r=t.interpolate||K,a="__p+='",r=ke((t.escape||K).source+"|"+r.source+"|"+(r===B?D:K).source+"|"+(t.evaluate||K).source+"|$","g");if(n.replace(r,function(t,r,o,i,c,l){return o||(o=i),a+=n.slice(f,l).replace(J,s),r&&(e=true,a+="'+__e("+r+")+'"),c&&(u=true,a+="';"+c+";\n__p+='"),o&&(a+="'+((__t=("+o+"))==null?'':__t)+'"),f=l+t.length,t}),a+="';",(r=t.variable)||(a="with(obj){"+a+"}"),a=(u?a.replace(F,""):a).replace(T,"$1").replace(U,"$1;"),a="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(e?",__e=_.escape":"")+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",r=ve(function(){return xe(o,"return "+a).apply(d,i)
+}),r.source=a,ue(r))throw r;return r},Z.trim=ge,Z.trimLeft=function(n,t){return(n=null==n?"":Re(n))?null==t?n.slice(h(n)):(t=Re(t),n.slice(o(n,t))):n},Z.trimRight=function(n,t){return(n=null==n?"":Re(n))?null==t?n.slice(0,g(n)+1):(t=Re(t),n.slice(0,i(n,t)+1)):n},Z.trunc=function(n,t){var r=30,e="...";if(ie(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Re(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Re(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e;
+if(r=n.slice(0,o),null==u)return r+e;if(ae(u)){if(n.slice(o).search(u)){var i,f,a=n.slice(0,o);for(u.global||(u=ke(u.source,(M.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(a);)f=i.index;r=r.slice(0,null==f?o:f)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Jt(Z,function(n,t){var r="sample"!=t;Z.prototype[t]||(Z.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new X(o,u):o})}),Z.VERSION=m,Z.prototype.chain=function(){return this.__chain__=true,this},Z.prototype.toJSON=Lr,Z.prototype.toString=function(){return Re(this.__wrapped__)
+},Z.prototype.value=Lr,Z.prototype.valueOf=Lr,jt(["join","pop","shift"],function(n){var t=Ce[n];Z.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new X(r,n):r}}),jt(["push","reverse","sort","unshift"],function(n){var t=Ce[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),jt(["concat","splice"],function(n){var t=Ce[n];Z.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Z}var d,m="3.0.0-pre",_=1,b=2,w=4,j=8,A=16,x=32,E=64,I="__lodash@"+m+"__",O="Expected a function",k=Math.pow(2,32)-1,R=Math.pow(2,53)-1,S=0,C=/^[A-Z]+$/,F=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,U=/(__e\(.*?\)|\b__t\))\+'';/g,W=/&(?:amp|lt|gt|quot|#39|#96);/g,N=/[&<>"'`]/g,L=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,P=/^\[object .+?Constructor\]$/,Z=/[\xC0-\xFF]/g,K=/($^)/,V=/[.*+?^${}()|[\]\/\\]/g,Y=/\bthis\b/,J=/['\n\r\u2028\u2029\\]/g,X=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,G=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",H="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),Q="[object Arguments]",nt="[object Array]",tt="[object Boolean]",rt="[object Date]",et="[object Error]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",ft="[object String]",at="[object ArrayBuffer]",ct="[object Float32Array]",lt="[object Float64Array]",pt="[object Int8Array]",st="[object Int16Array]",ht="[object Int32Array]",gt="[object Uint8Array]",vt="[object Uint8ClampedArray]",yt="[object Uint16Array]",dt="[object Uint32Array]",mt={};
+mt[Q]=mt[nt]=mt[ct]=mt[lt]=mt[pt]=mt[st]=mt[ht]=mt[gt]=mt[vt]=mt[yt]=mt[dt]=true,mt[at]=mt[tt]=mt[rt]=mt[et]=mt["[object Function]"]=mt["[object Map]"]=mt[ut]=mt[ot]=mt[it]=mt["[object Set]"]=mt[ft]=mt["[object WeakMap]"]=false;var _t={};_t[Q]=_t[nt]=_t[at]=_t[tt]=_t[rt]=_t[ct]=_t[lt]=_t[pt]=_t[st]=_t[ht]=_t[ut]=_t[ot]=_t[it]=_t[ft]=_t[gt]=_t[vt]=_t[yt]=_t[dt]=true,_t[et]=_t["[object Function]"]=_t["[object Map]"]=_t["[object Set]"]=_t["[object WeakMap]"]=false;var bt={leading:false,maxWait:0,trailing:false},wt={configurable:false,enumerable:false,value:null,writable:false},jt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},At={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},xt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},Et={"function":true,object:true},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ot=Et[typeof window]&&window||this,kt=Et[typeof exports]&&exports&&!exports.nodeType&&exports,Et=Et[typeof module]&&module&&!module.nodeType&&module,Rt=kt&&Et&&typeof global=="object"&&global;
+!Rt||Rt.global!==Rt&&Rt.window!==Rt&&Rt.self!==Rt||(Ot=Rt);var Rt=Et&&Et.exports===kt&&kt,St=y();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ot._=St, define(function(){return St})):kt&&Et?Rt?(Et.exports=St)._=St:kt._=St:Ot._=St}).call(this);
\ No newline at end of file
diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js
index ac4be7f44..0cbc97afd 100644
--- a/dist/lodash.underscore.js
+++ b/dist/lodash.underscore.js
@@ -303,7 +303,6 @@
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
nativeIsFinite = root.isFinite,
- nativeIsNaN = root.isNaN,
nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
nativeMax = Math.max,
nativeMin = Math.min,
@@ -593,7 +592,7 @@
* @param {Array} array The array to iterate over.
* @param {Function} iterator The function called per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initFromArray=false] Specify using the first element of
+ * @param {boolean} [initFromArray=false] Specify using the last element of
* `array` as the initial value.
* @returns {*} Returns the accumulated value.
*/
@@ -642,29 +641,35 @@
* @returns {Function} Returns the new function.
*/
function baseCallback(func, thisArg, argCount) {
- if (typeof func != 'function') {
+ var type = typeof func;
+
+ if (type == 'function') {
+ if (typeof thisArg == 'undefined') {
+ return func;
+ }
+ switch (argCount) {
+ case 1: return function(value) {
+ return func.call(thisArg, value);
+ };
+ case 3: return function(value, index, collection) {
+ return func.call(thisArg, value, index, collection);
+ };
+ case 4: return function(accumulator, value, index, collection) {
+ return func.call(thisArg, accumulator, value, index, collection);
+ };
+ case 5: return function(value, other, key, object, source) {
+ return func.call(thisArg, value, other, key, object, source);
+ };
+ }
+ return function() {
+ return func.apply(thisArg, arguments);
+ };
+ }
+ if (func == null) {
return identity;
}
- if (typeof thisArg == 'undefined') {
- return func;
- }
- switch (argCount) {
- case 1: return function(value) {
- return func.call(thisArg, value);
- };
- case 3: return function(value, index, collection) {
- return func.call(thisArg, value, index, collection);
- };
- case 4: return function(accumulator, value, index, collection) {
- return func.call(thisArg, accumulator, value, index, collection);
- };
- case 5: return function(value, other, key, object, source) {
- return func.call(thisArg, value, other, key, object, source);
- };
- }
- return function() {
- return func.apply(thisArg, arguments);
- };
+ // handle "_.pluck" and "_.where" style callback shorthands
+ return type == 'object' ? matches(func) : property(func);
}
/**
@@ -1283,7 +1288,7 @@
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iterator The function called per iteration.
* @param {*} accumulator The initial value.
- * @param {boolean} initFromCollection Specify using the first element
+ * @param {boolean} initFromCollection Specify using the first or last element
* of `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
@@ -1354,31 +1359,21 @@
*
* @private
* @param {Array} array The array to inspect.
- * @param {boolean} [isSorted=false] Specify the array is sorted.
* @param {Function} [iterator] The function called per iteration.
* @returns {Array} Returns the new duplicate-value-free array.
*/
- function baseUniq(array, isSorted, iterator) {
- var length = array ? array.length : 0;
- if (!length) {
- return [];
- }
+ function baseUniq(array, iterator) {
var index = -1,
indexOf = getIndexOf(),
+ length = array.length,
result = [],
- seen = (iterator && !isSorted) ? [] : result;
+ seen = iterator ? [] : result;
while (++index < length) {
var value = array[index],
computed = iterator ? iterator(value, index, array) : value;
- if (isSorted) {
- if (!index || seen !== computed) {
- seen = computed;
- result.push(value);
- }
- }
- else if (indexOf(seen, computed) < 0) {
+ if (indexOf(seen, computed) < 0) {
if (iterator) {
seen.push(computed);
}
@@ -1455,7 +1450,7 @@
function createAggregator(setter, initializer) {
return function(collection, iterator, thisArg) {
var result = initializer ? initializer() : {};
- iterator = callback(iterator, thisArg, 3);
+ iterator = baseCallback(iterator, thisArg, 3);
if (isArray(collection)) {
var index = -1,
@@ -1626,14 +1621,16 @@
/**
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is
* customized this function returns the custom method, otherwise it returns
- * the `baseIndexOf` function.
+ * the `baseIndexOf` function. If arguments are provided the chosen function
+ * is executed with the arguments and its result is returned.
*
* @private
- * @returns {Function} Returns the "indexOf" function.
+ * @returns {Function|number} Returns the chosen function or its result.
*/
- function getIndexOf() {
+ function getIndexOf(collection, target, fromIndex) {
var result = lodash.indexOf || indexOf;
- return result === indexOf ? baseIndexOf : result;
+ result = result === indexOf ? baseIndexOf : result;
+ return collection ? result(collection, target, fromIndex) : result;
}
/**
@@ -1673,6 +1670,33 @@
return result;
}
+ /**
+ * An implementation of `_.uniq` optimized for sorted arrays without support
+ * for callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iterator] The function called per iteration.
+ * @returns {Array} Returns the new duplicate-value-free array.
+ */
+ function sortedUniq(array, iterator) {
+ var seen,
+ index = -1,
+ length = array.length,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index],
+ computed = iterator ? iterator(value, index, array) : value;
+
+ if (!index || seen !== computed) {
+ seen = computed;
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
/**
* Converts `collection` to an array if it is not an array-like value.
*
@@ -1819,7 +1843,7 @@
var index = -1,
length = array ? array.length : 0;
- predicate = callback(predicate, thisArg, 3);
+ predicate = baseCallback(predicate, thisArg, 3);
while (++index < length) {
if (predicate(array[index], index, array)) {
return index;
@@ -2164,7 +2188,7 @@
* // => 1
*/
function sortedIndex(array, value, iterator, thisArg) {
- iterator = iterator == null ? identity : callback(iterator, thisArg, 1);
+ iterator = iterator == null ? identity : baseCallback(iterator, thisArg, 1);
return baseSortedIndex(array, value, iterator);
}
@@ -2274,9 +2298,11 @@
}
}
if (iterator != null) {
- iterator = callback(iterator, thisArg, 3);
+ iterator = baseCallback(iterator, thisArg, 3);
}
- return baseUniq(array, isSorted, iterator);
+ return (isSorted && getIndexOf() == baseIndexOf)
+ ? sortedUniq(array, iterator)
+ : baseUniq(array, iterator);
}
/**
@@ -2348,7 +2374,7 @@
/**
* Creates an object composed from arrays of property names and values. Provide
- * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+ * either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]`
* or two arrays, one of property names and one of corresponding values.
*
* @static
@@ -2517,13 +2543,12 @@
* // => true
*/
function contains(collection, target) {
- var indexOf = getIndexOf(),
- length = collection ? collection.length : 0;
+ var length = collection ? collection.length : 0;
if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) {
collection = values(collection);
}
- return indexOf(collection, target) > -1;
+ return getIndexOf(collection, target) > -1;
}
/**
@@ -2607,7 +2632,7 @@
*/
function every(collection, predicate, thisArg) {
if (typeof predicate != 'function' || typeof thisArg != 'undefined') {
- predicate = callback(predicate, thisArg, 3);
+ predicate = baseCallback(predicate, thisArg, 3);
}
var func = isArray(collection) ? arrayEvery : baseEvery;
return func(collection, predicate);
@@ -2654,7 +2679,7 @@
* // => [{ 'name': 'barney', 'age': 36 }]
*/
function filter(collection, predicate, thisArg) {
- predicate = callback(predicate, thisArg, 3);
+ predicate = baseCallback(predicate, thisArg, 3);
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, predicate);
@@ -2708,7 +2733,7 @@
var index = findIndex(collection, predicate, thisArg);
return index > -1 ? collection[index] : undefined;
}
- predicate = callback(predicate, thisArg, 3);
+ predicate = baseCallback(predicate, thisArg, 3);
return baseFind(collection, predicate, baseEach);
}
@@ -2924,7 +2949,7 @@
* // => ['barney', 'fred']
*/
function map(collection, iterator, thisArg) {
- iterator = callback(iterator, thisArg, 3);
+ iterator = baseCallback(iterator, thisArg, 3);
var func = isArray(collection) ? arrayMap : baseMap;
return func(collection, iterator);
@@ -2982,18 +3007,20 @@
if ((type == 'number' || type == 'string') && thisArg && thisArg[iterator] === collection) {
iterator = null;
}
- if (iterator == null && isArray(collection)) {
+
+ if (iterator == null) {
var index = -1,
- length = collection.length;
+ iterable = toIterable(collection),
+ length = iterable.length;
while (++index < length) {
- var value = collection[index];
+ var value = iterable[index];
if (value > result) {
result = value;
}
}
} else {
- iterator = callback(iterator, thisArg, 3);
+ iterator = baseCallback(iterator, thisArg, 3);
baseEach(collection, function(value, index, collection) {
var current = iterator(value, index, collection);
@@ -3058,18 +3085,20 @@
if ((type == 'number' || type == 'string') && thisArg && thisArg[iterator] === collection) {
iterator = null;
}
- if (iterator == null && isArray(collection)) {
+
+ if (iterator == null) {
var index = -1,
- length = collection.length;
+ iterable = toIterable(collection),
+ length = iterable.length;
while (++index < length) {
- var value = collection[index];
+ var value = iterable[index];
if (value < result) {
result = value;
}
}
} else {
- iterator = callback(iterator, thisArg, 3);
+ iterator = baseCallback(iterator, thisArg, 3);
baseEach(collection, function(value, index, collection) {
var current = iterator(value, index, collection);
@@ -3183,7 +3212,7 @@
*/
function reduce(collection, iterator, accumulator, thisArg) {
var func = isArray(collection) ? arrayReduce : baseReduce;
- return func(collection, callback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEach);
+ return func(collection, baseCallback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEach);
}
/**
@@ -3207,7 +3236,7 @@
*/
function reduceRight(collection, iterator, accumulator, thisArg) {
var func = isArray(collection) ? arrayReduceRight : baseReduce;
- return func(collection, callback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEachRight);
+ return func(collection, baseCallback(iterator, thisArg, 4), accumulator, arguments.length < 3, baseEachRight);
}
/**
@@ -3249,7 +3278,7 @@
* // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
*/
function reject(collection, predicate, thisArg) {
- predicate = callback(predicate, thisArg, 3);
+ predicate = baseCallback(predicate, thisArg, 3);
return filter(collection, negate(predicate));
}
@@ -3386,7 +3415,7 @@
*/
function some(collection, predicate, thisArg) {
if (typeof predicate != 'function' || typeof thisArg != 'undefined') {
- predicate = callback(predicate, thisArg, 3);
+ predicate = baseCallback(predicate, thisArg, 3);
}
var func = isArray(collection) ? arraySome : baseSome;
return func(collection, predicate);
@@ -3446,7 +3475,7 @@
length = collection && collection.length,
result = Array(length < 0 ? 0 : length >>> 0);
- iterator = callback(iterator, thisArg, 3);
+ iterator = baseCallback(iterator, thisArg, 3);
baseEach(collection, function(value, key, collection) {
result[++index] = {
'criteria': iterator(value, key, collection),
@@ -4365,7 +4394,7 @@
}
/**
- * Checks if `value` is an `arguments` object.
+ * Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
@@ -4387,19 +4416,20 @@
// fallback for environments without a `[[Class]]` for `arguments` objects
if (!isArguments(arguments)) {
isArguments = function(value) {
- return (value && typeof value == 'object' && typeof value.length == 'number' &&
+ var length = (value && typeof value == 'object') ? value.length : undefined;
+ return (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER &&
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee')) || false;
};
}
/**
- * Checks if `value` is an array.
+ * Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -4414,13 +4444,13 @@
};
/**
- * Checks if `value` is a boolean value.
+ * Checks if `value` is classified as a boolean primitive or object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a boolean value, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isBoolean(false);
@@ -4435,13 +4465,13 @@
}
/**
- * Checks if `value` is a `Date` object.
+ * Checks if `value` is classified as a `Date` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isDate(new Date);
@@ -4578,7 +4608,7 @@
}
/**
- * Checks if `value` is a finite number.
+ * Checks if `value` is a finite primitive number.
*
* Note: This method is based on ES6 `Number.isFinite`. See the
* [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite)
@@ -4588,7 +4618,7 @@
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is finite, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* @example
*
* _.isFinite(10);
@@ -4611,13 +4641,13 @@
}
/**
- * Checks if `value` is a function.
+ * Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
@@ -4720,16 +4750,16 @@
}
/**
- * Checks if `value` is a `Number` primitive or object.
+ * Checks if `value` is classified as a `Number` primitive or object.
*
- * Note: `NaN` is considered a number. See the [ES5 spec](http://es5.github.io/#x8.5)
- * for more details.
+ * Note: To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
+ * as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a number, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isNumber(8.4);
@@ -4748,13 +4778,13 @@
}
/**
- * Checks if `value` is a `RegExp` object.
+ * Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a regexp object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -4764,17 +4794,17 @@
* // => false
*/
function isRegExp(value) {
- return (isObject(value) && toString.call(value) == regexpClass) || false;
+ return (value && typeof value == 'object' && toString.call(value) == regexpClass) || false;
}
/**
- * Checks if `value` is a `String` primitive or object.
+ * Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Object
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
@@ -4900,7 +4930,7 @@
/**
* Creates a two dimensional array of a given object's key-value pairs,
- * i.e. `[[key1, value1], [key2, value2]]`.
+ * e.g. `[[key1, value1], [key2, value2]]`.
*
* @static
* @memberOf _
@@ -5006,7 +5036,11 @@
* // => 'fred, barney, & pebbles'
*/
function escape(string) {
- return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+ // reset `lastIndex` because in IE < 9 `String#replace` does not
+ string = string == null ? '' : String(string);
+ return (reUnescapedHtml.lastIndex = 0, reUnescapedHtml.test(string))
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
+ : string;
}
/**
@@ -5024,7 +5058,10 @@
* // => '\[lodash\]\(http://lodash\.com\)'
*/
function escapeRegExp(string) {
- return string == null ? '' : String(string).replace(reRegExpChars, '\\$&');
+ string = string == null ? '' : String(string);
+ return (reRegExpChars.lastIndex = 0, reRegExpChars.test(string))
+ ? string.replace(reRegExpChars, '\\$&')
+ : string;
}
/**
@@ -5034,7 +5071,7 @@
* properties may be accessed as free variables in the template. If a setting
* object is provided it overrides `_.templateSettings` for the template.
*
- * Note: In the development build, `_.template` utilizes sourceURLs 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.
*
@@ -5073,22 +5110,27 @@
* compiled({ 'people': ['fred', 'barney'] });
* // => 'fredbarney'
*
- * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
- * var compiled = _.template('hello ${ name }');
- * compiled({ 'name': 'pebbles' });
- * // => 'hello pebbles'
- *
* // using the internal `print` function in "evaluate" delimiters
* var compiled = _.template('<% print("hello " + name); %>!');
* compiled({ 'name': 'barney' });
* // => 'hello barney!'
*
- * // using a custom template delimiters
+ * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+ * var compiled = _.template('hello ${ name }');
+ * compiled({ 'name': 'pebbles' });
+ * // => 'hello pebbles'
+ *
+ * // using custom template delimiters
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ name }}!');
* compiled({ 'name': 'mustache' });
* // => 'hello mustache!'
*
+ * // using backslashes to treat delimiters as plain text
+ * var compiled = _.template('<%= "\\<%- value %\\>" %>');
+ * compiled({ 'value': 'ignored' });
+ * // => '<%- value %>'
+ *
* // using the `imports` option to import `jQuery` as `jq`
* var text = '<% jq.each(people, function(name) { %><%- name %><% }); %>';
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
@@ -5189,11 +5231,10 @@
* // => 'fred, barney & pebbles'
*/
function unescape(string) {
- if (string == null) {
- return '';
- }
- string = String(string);
- return string.indexOf(';') < 0 ? string : string.replace(reEscapedHtml, unescapeHtmlChar);
+ string = string == null ? '' : String(string);
+ return (reEscapedHtml.lastIndex = 0, reEscapedHtml.test(string))
+ ? string.replace(reEscapedHtml, unescapeHtmlChar)
+ : string;
}
/*--------------------------------------------------------------------------*/
@@ -5226,51 +5267,6 @@
}
}
- /**
- * Creates a function bound to an optional `thisArg`. If `func` is a property
- * name the created callback returns the property value for a given element.
- * If `func` is an object the created callback returns `true` for elements
- * that contain the equivalent object properties, otherwise it returns `false`.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {*} [func=identity] The value to convert to a callback.
- * @param {*} [thisArg] The `this` binding of the created callback.
- * @param {number} [argCount] The number of arguments the callback accepts.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var characters = [
- * { 'name': 'barney', 'age': 36 },
- * { 'name': 'fred', 'age': 40 }
- * ];
- *
- * // wrap to create custom callback shorthands
- * _.callback = _.wrap(_.callback, function(func, callback, thisArg) {
- * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
- * return !match ? func(callback, thisArg) : function(object) {
- * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
- * };
- * });
- *
- * _.filter(characters, 'age__gt38');
- * // => [{ 'name': 'fred', 'age': 40 }]
- */
- function callback(func, thisArg, argCount) {
- var type = typeof func,
- isFunc = type == 'function';
-
- if (isFunc && typeof thisArg == 'undefined') {
- return func;
- }
- if (isFunc || func == null) {
- return baseCallback(func, thisArg, argCount);
- }
- // handle "_.pluck" and "_.where" style callback shorthands
- return type == 'object' ? matches(func) : property(func);
- }
-
/**
* Creates a function that returns `value`.
*
diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js
index 50faef651..fb2f01a1d 100644
--- a/dist/lodash.underscore.min.js
+++ b/dist/lodash.underscore.min.js
@@ -3,43 +3,43 @@
* Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE
* Build: `lodash underscore -o ./dist/lodash.underscore.js`
*/
-;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(te||typeof t=="undefined"){t=1;break n}if(tu(r,i)&&o.push(i)}return o}function b(n,r){var t=n?n.length:0;if(typeof t!="number"||-1>=t||t>$r)return x(n,r,Ut);for(var e=-1,u=P(n);++e=t||t>$r){for(var t=Ut(n),e=t.length;e--;){var u=t[e];if(r(n[u],u,n)===Nr)break}return n}for(e=P(n);t--&&r(e[t],t,n)!==Nr;);return n}function d(n,r){var t=true;return b(n,function(n,e,u){return(t=!!r(n,e,u))||Nr}),t}function j(n,r){var t=[];return b(n,function(n,e,u){r(n,e,u)&&t.push(n)}),t}function w(n,r,t){var e;return t(n,function(n,t,u){return r(n,t,u)?(e=n,Nr):void 0}),e}function A(n,r,t,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++eo(f,c)&&(t&&f.push(c),i.push(a))}return i}function B(n,r){return function(t,e,u){var o=r?r():{};if(e=xr(e,u,3),Rt(t)){u=-1;for(var i=t.length;++ur?0:r)}function G(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?Tt(u+e,0):e||0;else if(e)return e=K(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function H(n,r,t){return J(n,null==r||t?1:0>r?0:r)}function J(n,r,t){var e=-1,u=n?n.length:0;for(r=null==r?0:+r||0,0>r?r=Tt(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=Tt(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1;t(n[o])u&&(u=i)}else r=xr(r,t,3),b(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function er(n,r){return rr(n,kr(r))}function ur(n,r,t,e){return(Rt(n)?p:I)(n,xr(r,e,4),t,3>arguments.length,b)}function or(n,r,t,e){return(Rt(n)?s:I)(n,xr(r,e,4),t,3>arguments.length,_)}function ir(n){n=P(n);for(var r=-1,t=n.length,e=Array(t);++r=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=Sr,t&&(g=Wt(),a=n.apply(l,i),p||f||(i=l=null))):p=setTimeout(e,t)}function u(){p&&clearTimeout(p),f=p=s=Sr,(v||h!==r)&&(g=Wt(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Wt(),l=this,s=v&&(p||!y),false===h)var t=y&&!p;else{f||y||(g=c);var o=h-(c-g),m=0>=o||o>h;m?(f&&(f=clearTimeout(f)),g=c,a=n.apply(l,i)):f||(f=setTimeout(u,o))}return m&&p?p=clearTimeout(p):p||r===h||(p=setTimeout(e,r)),t&&(m=true,a=n.apply(l,i)),!m||p||f||(i=l=null),a
-}var i,f,a,c,l,p,s,g=0,h=false,v=true;if(!yr(n))throw new TypeError(qr);if(r=0>r?0:r,true===t)var y=true,v=false;else mr(t)&&(y=t.leading,h="maxWait"in t&&Tt(+t.maxWait||0,r),v="trailing"in t?t.trailing:v);return o.cancel=function(){p&&clearTimeout(p),f&&clearTimeout(f),f=p=s=Sr},o}function cr(n){if(!yr(n))throw new TypeError(qr);return function(){return!n.apply(this,arguments)}}function lr(n){return S(n,Ir,J(arguments,1))}function pr(n){if(null==n)return n;var r=arguments,t=0,e=r.length,u=typeof r[2];for("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2);++t"'`]/g,Dr=/^\[object .+?Constructor\]$/,zr=/($^)/,Cr=/[.*+?^${}()|[\]\/\\]/g,Pr=/['\n\r\u2028\u2029\\]/g,Vr="[object Arguments]",Gr="[object Boolean]",Hr="[object Date]",Jr="[object Error]",Kr="[object Number]",Lr="[object Object]",Qr="[object RegExp]",Xr="[object String]",Yr={};
-Yr[Vr]=Yr["[object Array]"]=Yr["[object Float32Array]"]=Yr["[object Float64Array]"]=Yr["[object Int8Array]"]=Yr["[object Int16Array]"]=Yr["[object Int32Array]"]=Yr["[object Uint8Array]"]=Yr["[object Uint8ClampedArray]"]=Yr["[object Uint16Array]"]=Yr["[object Uint32Array]"]=true,Yr["[object ArrayBuffer]"]=Yr[Gr]=Yr[Hr]=Yr[Jr]=Yr["[object Function]"]=Yr["[object Map]"]=Yr[Kr]=Yr[Lr]=Yr[Qr]=Yr["[object Set]"]=Yr[Xr]=Yr["[object WeakMap]"]=false;var Zr={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},nt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},rt={"function":true,object:true},tt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},et=rt[typeof window]&&window||this,ut=rt[typeof exports]&&exports&&!exports.nodeType&&exports,ot=rt[typeof module]&&module&&!module.nodeType&&module,it=ut&&ot&&typeof global=="object"&&global;
-!it||it.global!==it&&it.window!==it&&it.self!==it||(et=it);var ft=ot&&ot.exports===ut&&ut,at=Array.prototype,ct=Object.prototype,lt=Function.prototype.toString,pt=et._,st=ct.toString,gt=RegExp("^"+(null==st?"":(st+"").replace(Cr,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ht=Math.ceil,vt=Math.floor,yt=ct.hasOwnProperty,mt=at.push,bt=ct.propertyIsEnumerable,_t=at.splice,dt=z(dt=Object.create)&&dt,jt=z(jt=Array.isArray)&&jt,wt=et.isFinite,At=et.isNaN,xt=z(xt=Object.keys)&&xt,Tt=Math.max,Et=Math.min,Ot=z(Ot=Date.now)&&Ot,kt=Math.random,St={};
-!function(){var n={0:1,length:1};St.spliceObjects=(_t.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},dt||(v=function(){function n(){}return function(r){if(mr(r)){n.prototype=r;var t=new n;n.prototype=null}return t||et.Object()}}());var Ft=H,Mt=V,It=B(function(n,r,t){yt.call(n,t)?n[t]++:n[t]=1}),Nt=B(function(n,r,t){yt.call(n,t)?n[t].push(r):n[t]=[r]}),qt=B(function(n,r,t){n[t]=r}),Bt=B(function(n,r,t){n[t?0:1].push(r)
-},function(){return[[],[]]}),$t=lr(function(n,r){var t;if(!yr(r))throw new TypeError(qr);return function(){return 0<--n?t=r.apply(this,arguments):r=null,t}},2);hr(arguments)||(hr=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&yt.call(n,"callee")&&!bt.call(n,"callee")||false});var Rt=jt||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&"[object Array]"==st.call(n)||false};yr(/x/)&&(yr=function(n){return typeof n=="function"&&"[object Function]"==st.call(n)});var Ut=xt?function(n){return mr(n)?xt(n):[]
-}:C,Wt=Ot||function(){return(new Date).getTime()};i.prototype=o.prototype,o.after=function(n,r){if(!yr(r))throw new TypeError(qr);return n=wt(n=+n)?n:0,function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=function(n,r){return 3>arguments.length?W(n,Fr,r):S(n,Fr|Ir,J(arguments,2),r)},o.bindAll=function(n){for(var r=n,t=1r?0:r)
-},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=Ut(n),e=t.length,u={};++ro?0:o>>>0);for(t=xr(t,e,3),b(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.take=Mt,o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!yr(n))throw new TypeError(funcErrorText);return false===t?e=false:mr(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),ar(n,r,{leading:e,maxWait:r,trailing:u})
-},o.times=function(n,r,t){n=wt(n=+n)&&-1r?0:r))},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Tt(e+t,0):Et(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.max=tr,o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;if("number"!=o&&"string"!=o||!t||t[r]!==n||(r=null),null==r&&Rt(n))for(t=-1,o=n.length;++tn.indexOf(";")?n:n.replace(Ur,u))},o.uniqueId=function(n){var r=++Rr+"";return n?n+r:r},o.all=X,o.any=fr,o.detect=Z,o.foldl=ur,o.foldr=or,o.head=V,o.include=Q,o.inject=ur,o.sample=function(n,r,t){n=P(n);var e=n.length;return null==r||t?0r?0:+r||0,n.length),n)},Or(pr({},o)),o.VERSION="3.0.0-pre",o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.value=function(){return this.__wrapped__
-},f("pop push reverse shift sort splice unshift".split(" "),function(n){var r=at[n];o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),St.spliceObjects||0!==n.length||delete n[0],this}}),f(["concat","join","slice"],function(n){var r=at[n];o.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(et._=o, define("underscore",function(){return o
-})):ut&&ot?ft?(ot.exports=o)._=o:ut._=o:et._=o}).call(this);
\ No newline at end of file
+return false}function h(n,r,t){var e=typeof n;if("function"==e){if(typeof r=="undefined")return n;switch(t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)};case 5:return function(t,e,u,o,i){return n.call(r,t,e,u,o,i)}}return function(){return n.apply(r,arguments)}}return null==n?xr:"object"==e?Tr(n):Or(n)}function v(n){return mr(n)?_t(n):{}}function y(n){function r(){for(var n=arguments.length,t=n,n=Array(n);t--;)n[t]=arguments[t];
+if(i){for(var t=n,n=e.length,c=-1,l=At(t.length-n,0),p=-1,s=i.length,g=Array(l+s);++pu(r,i)&&o.push(i)}return o}function b(n,r){var t=n?n.length:0;
+if(typeof t!="number"||-1>=t||t>Br)return x(n,r,$t);for(var e=-1,u=P(n);++e=t||t>Br){for(var t=$t(n),e=t.length;e--;){var u=t[e];if(r(n[u],u,n)===Mr)break}return n}for(e=P(n);t--&&r(e[t],t,n)!==Mr;);return n}function d(n,r){var t=true;return b(n,function(n,e,u){return(t=!!r(n,e,u))||Mr}),t}function j(n,r){var t=[];return b(n,function(n,e,u){r(n,e,u)&&t.push(n)}),t}function w(n,r,t){var e;return t(n,function(n,t,u){return r(n,t,u)?(e=n,Mr):void 0
+}),e}function A(n,r,t,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++ee(i,a)&&(r&&i.push(a),o.push(f))
+}return o}function B(n,r){return function(t,e,u){var o=r?r():{};if(e=h(e,u,3),Bt(t)){u=-1;for(var i=t.length;++ur?0:r)}function G(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?At(u+e,0):e||0;else if(e)return e=K(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function H(n,r,t){return J(n,null==r||t?1:0>r?0:r)}function J(n,r,t){var e=-1,u=n?n.length:0;for(r=null==r?0:+r||0,0>r?r=At(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=At(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1;t(n[o])u&&(u=i)}else r=h(r,t,3),b(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function er(n,r){return rr(n,Or(r))}function ur(n,r,t,e){return(Bt(n)?p:M)(n,h(r,e,4),t,3>arguments.length,b)}function or(n,r,t,e){return(Bt(n)?s:M)(n,h(r,e,4),t,3>arguments.length,_)}function ir(n){n=P(n);for(var r=-1,t=n.length,e=Array(t);++r=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=kr,t&&(g=Rt(),a=n.apply(l,i),p||f||(i=l=null))):p=setTimeout(e,t)}function u(){p&&clearTimeout(p),f=p=s=kr,(v||h!==r)&&(g=Rt(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Rt(),l=this,s=v&&(p||!y),false===h)var t=y&&!p;else{f||y||(g=c);var o=h-(c-g),m=0>=o||o>h;m?(f&&(f=clearTimeout(f)),g=c,a=n.apply(l,i)):f||(f=setTimeout(u,o))
+}return m&&p?p=clearTimeout(p):p||r===h||(p=setTimeout(e,r)),t&&(m=true,a=n.apply(l,i)),!m||p||f||(i=l=null),a}var i,f,a,c,l,p,s,g=0,h=false,v=true;if(!yr(n))throw new TypeError(Nr);if(r=0>r?0:r,true===t)var y=true,v=false;else mr(t)&&(y=t.leading,h="maxWait"in t&&At(+t.maxWait||0,r),v="trailing"in t?t.trailing:v);return o.cancel=function(){p&&clearTimeout(p),f&&clearTimeout(f),f=p=s=kr},o}function cr(n){if(!yr(n))throw new TypeError(Nr);return function(){return!n.apply(this,arguments)}}function lr(n){return S(n,Fr,J(arguments,1))
+}function pr(n){if(null==n)return n;var r=arguments,t=0,e=r.length,u=typeof r[2];for("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2);++t"'`]/g,Wr=/^\[object .+?Constructor\]$/,Dr=/($^)/,zr=/[.*+?^${}()|[\]\/\\]/g,Cr=/['\n\r\u2028\u2029\\]/g,Pr="[object Arguments]",Vr="[object Boolean]",Gr="[object Date]",Hr="[object Error]",Jr="[object Number]",Kr="[object Object]",Lr="[object RegExp]",Qr="[object String]",Xr={};
+Xr[Pr]=Xr["[object Array]"]=Xr["[object Float32Array]"]=Xr["[object Float64Array]"]=Xr["[object Int8Array]"]=Xr["[object Int16Array]"]=Xr["[object Int32Array]"]=Xr["[object Uint8Array]"]=Xr["[object Uint8ClampedArray]"]=Xr["[object Uint16Array]"]=Xr["[object Uint32Array]"]=true,Xr["[object ArrayBuffer]"]=Xr[Vr]=Xr[Gr]=Xr[Hr]=Xr["[object Function]"]=Xr["[object Map]"]=Xr[Jr]=Xr[Kr]=Xr[Lr]=Xr["[object Set]"]=Xr[Qr]=Xr["[object WeakMap]"]=false;var Yr={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Zr={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},nt={"function":true,object:true},rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=nt[typeof window]&&window||this,et=nt[typeof exports]&&exports&&!exports.nodeType&&exports,ut=nt[typeof module]&&module&&!module.nodeType&&module,ot=et&&ut&&typeof global=="object"&&global;
+!ot||ot.global!==ot&&ot.window!==ot&&ot.self!==ot||(tt=ot);var it=ut&&ut.exports===et&&et,ft=Array.prototype,at=Object.prototype,ct=Function.prototype.toString,lt=tt._,pt=at.toString,st=RegExp("^"+function(n){return n=null==n?"":n+"",zr.lastIndex=0,zr.test(n)?n.replace(zr,"\\$&"):n}(pt).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gt=Math.ceil,ht=Math.floor,vt=at.hasOwnProperty,yt=ft.push,mt=at.propertyIsEnumerable,bt=ft.splice,_t=z(_t=Object.create)&&_t,dt=z(dt=Array.isArray)&&dt,jt=tt.isFinite,wt=z(wt=Object.keys)&&wt,At=Math.max,xt=Math.min,Tt=z(Tt=Date.now)&&Tt,Et=Math.random,Ot={};
+!function(){var n={0:1,length:1};Ot.spliceObjects=(bt.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},_t||(v=function(){function n(){}return function(r){if(mr(r)){n.prototype=r;var t=new n;n.prototype=null}return t||tt.Object()}}());var kt=H,St=V,It=B(function(n,r,t){vt.call(n,t)?n[t]++:n[t]=1}),Ft=B(function(n,r,t){vt.call(n,t)?n[t].push(r):n[t]=[r]}),Mt=B(function(n,r,t){n[t]=r}),Nt=B(function(n,r,t){n[t?0:1].push(r)
+},function(){return[[],[]]}),qt=lr(function(n,r){var t;if(!yr(r))throw new TypeError(Nr);return function(){return 0<--n?t=r.apply(this,arguments):r=null,t}},2);hr(arguments)||(hr=function(n){var r=n&&typeof n=="object"?n.length:kr;return typeof r=="number"&&-1--n?r.apply(this,arguments):void 0}},o.bind=function(n,r){return 3>arguments.length?W(n,Sr,r):S(n,Sr|Fr,J(arguments,2),r)},o.bindAll=function(n){for(var r=n,t=1r?0:r)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=$t(n),e=t.length,u={};++ro?0:o>>>0);for(t=h(t,e,3),b(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.take=St,o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!yr(n))throw new TypeError(funcErrorText);return false===t?e=false:mr(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),ar(n,r,{leading:e,maxWait:r,trailing:u})
+},o.times=function(n,r,t){n=jt(n=+n)&&-1r?0:r))},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?At(e+t,0):xt(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1
+},o.max=tr,o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;if("number"!=o&&"string"!=o||!t||t[r]!==n||(r=null),null==r)for(t=-1,n=P(n),o=n.length;++tr?0:+r||0,n.length),n)},Er(pr({},o)),o.VERSION="3.0.0-pre",o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.value=function(){return this.__wrapped__},f("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ft[n];o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ot.spliceObjects||0!==n.length||delete n[0],this}}),f(["concat","join","slice"],function(n){var r=ft[n];
+o.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(tt._=o, define("underscore",function(){return o})):et&&ut?it?(ut.exports=o)._=o:et._=o:tt._=o}).call(this);
\ No newline at end of file