From 78a312f61c27b1819c7c551c55eecaaad0ee7f8d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 21 May 2014 16:07:19 -0700 Subject: [PATCH] Rebuild dist. --- dist/lodash.compat.js | 746 +++++++++++++++++++-------------- dist/lodash.compat.min.js | 130 +++--- dist/lodash.js | 748 ++++++++++++++++++++-------------- dist/lodash.min.js | 123 +++--- dist/lodash.underscore.js | 302 +++++++++----- dist/lodash.underscore.min.js | 72 ++-- 6 files changed, 1257 insertions(+), 864 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 61e4bfe99..77e17cb8c 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -85,7 +85,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to match words to create compound words */ - var reWords = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g; + var reWords = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g; /** Used to detect and test whitespace */ var whitespace = ( @@ -112,7 +112,7 @@ 'toLocaleString', 'toString', 'valueOf' ]; - /** Used to make template `sourceURL`s easier to identify */ + /** Used to make template sourceURLs easier to identify */ var templateCounter = 0; /** `Object#toString` result shortcuts */ @@ -238,24 +238,12 @@ /*--------------------------------------------------------------------------*/ /** - * Used by `_.defaults` to customize its `_.assign` use. - * - * @private - * @param {*} objectValue The destination object property value. - * @param {*} sourceValue The source object property value. - * @returns {*} Returns the value to assign to the destination object. - */ - function assignDefaults(objectValue, sourceValue) { - return typeof objectValue == 'undefined' ? sourceValue : objectValue; - } - - /** - * The base implementation of `_.at` without support for strings or individual - * key arguments. + * The base implementation of `_.at` without support for strings and + * individual key arguments. * * @private * @param {Array|Object} collection The collection to iterate over. - * @param {number[]|string[]} [keys] The keys of elements to pick. + * @param {number[]|string[]} [props] The keys of elements to pick. * @returns {Array} Returns the new array of picked elements. */ function baseAt(collection, props) { @@ -552,6 +540,21 @@ * @category Utilities * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. + * @example + * + * var lodash = _.runInContext(); + * + * lodash.mixin({ + * 'exists': function(value) { + * return value != null; + * } + * }, false); + * + * _.isFunction(lodash.exists); + * // => true + * + * _.isFunction(_.exists); + * // => false */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named @@ -574,7 +577,7 @@ TypeError = context.TypeError; /** Used for native method references */ - var arrayRef = Array.prototype, + var arrayProto = Array.prototype, errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype; @@ -608,12 +611,12 @@ fnToString = Function.prototype.toString, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayRef.push, + push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, - splice = arrayRef.splice, - unshift = arrayRef.unshift; + splice = arrayProto.splice, + unshift = arrayProto.unshift; /** Used to set metadata on functions */ var defineProperty = (function() { @@ -1064,6 +1067,62 @@ return result; } + /** + * Used by `_.defaults` to customize its `_.assign` use. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignDefaults(objectValue, sourceValue) { + return typeof objectValue == 'undefined' ? sourceValue : objectValue; + } + + /** + * Used by `_.template` to customize its `_.assign` use. + * + * Note: This method is like `assignDefaults` except that it ignores + * inherited property values when checking if a property is `undefined`. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @param {string} key The key associated with the object and source values. + * @param {Object} object The destination object. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignOwnDefaults(objectValue, sourceValue, key, object) { + return (!hasOwnProperty.call(object, key) || typeof objectValue == 'undefined') + ? sourceValue + : objectValue + } + + /** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `this` binding. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} [callback] The function to customize assigning values. + * @returns {Object} Returns the destination object. + */ + function baseAssign(object, source, callback) { + if (!object) { + return object; + } + var index = -1, + props = keys(source), + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = callback ? callback(object[key], source[key], key, object, source) : source[key]; + } + return object; + } + /** * The base implementation of `_.bind` that creates the bound function and * sets its metadata. @@ -1084,12 +1143,11 @@ if (partialArgs) { // avoid `arguments` object use disqualifying optimizations by // converting it to an array before passing it to `composeArgs` - var index = -1, - length = arguments.length, + var length = arguments.length, args = Array(length); - while (++index < length) { - args[index] = arguments[index]; + while (length--) { + args[length] = arguments[length]; } args = composeArgs(partialArgs, partialHolders, args); } @@ -1109,8 +1167,8 @@ } /** - * The base implementation of `_.clone` without argument juggling or support - * for `this` binding. + * The base implementation of `_.clone` without support for argument juggling + * and `this` binding. * * @private * @param {*} value The value to clone. @@ -1121,11 +1179,9 @@ * @returns {*} Returns the cloned value. */ function baseClone(value, isDeep, callback, stackA, stackB) { - if (callback) { - var result = callback(value); - if (typeof result != 'undefined') { - return result; - } + var result = callback ? callback(value) : undefined; + if (typeof result != 'undefined') { + return result; } var isObj = isObject(value); if (isObj) { @@ -1166,7 +1222,7 @@ result = isArr ? ctor(value.length) : {}; } else { - result = isArr ? slice(value) : assign({}, value); + result = isArr ? slice(value) : baseAssign({}, value); } // add array properties assigned by `RegExp#exec` if (isArr) { @@ -1188,7 +1244,10 @@ // recursively populate clone (susceptible to call stack limits) (isArr ? arrayEach : baseForOwn)(value, function(valValue, key) { - result[key] = baseClone(valValue, isDeep, callback, stackA, stackB); + var valClone = callback ? callback(valValue, key) : undefined; + result[key] = typeof valClone == 'undefined' + ? baseClone(valValue, isDeep, null, stackA, stackB) + : valClone; }); return result; @@ -1222,7 +1281,7 @@ /** * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. + * "_.pluck" and "_.where" style callbacks. * * @private * @param {*} [func=identity] The value to convert to a callback. @@ -1302,11 +1361,11 @@ key = func; function bound() { - var index = -1, - length = arguments.length, + var length = arguments.length, + index = length, args = Array(length); - while (++index < length) { + while (index--) { args[index] = arguments[index]; } if (partialArgs) { @@ -1392,7 +1451,7 @@ /** * The base implementation of `_.forEach` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -1421,7 +1480,7 @@ /** * The base implementation of `_.forEachRight` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -1448,8 +1507,8 @@ } /** - * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey` - * without support for callback shorthands or `this` binding which iterates + * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, + * without support for callback shorthands and `this` binding, which iterates * over `collection` using the provided `eachFunc`. * * @private @@ -1474,7 +1533,7 @@ /** * The base implementation of `_.flatten` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array} array The array to flatten. @@ -1563,7 +1622,7 @@ /** * The base implementation of `_.forIn` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -1576,7 +1635,7 @@ /** * The base implementation of `_.forOwn` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -1589,7 +1648,7 @@ /** * The base implementation of `_.forOwnRight` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -1626,7 +1685,7 @@ /** * The base implementation of `_.isEqual`, without support for `thisArg` - * binding, that allows partial "_.where" style comparisons. + * binding, which allows partial "_.where" style comparisons. * * @private * @param {*} value The value to compare to `other`. @@ -1638,11 +1697,9 @@ * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, callback, isWhere, stackA, stackB) { - if (callback) { - var result = callback(value, other); - if (typeof result != 'undefined') { - return !!result; - } + var result = callback && !stackA ? callback(value, other) : undefined; + if (typeof result != 'undefined') { + return !!result; } // exit early for identical values if (value === other) { @@ -1740,7 +1797,6 @@ return stackB[length] == other; } } - var size = 0; result = true; // add `value` and `other` to the stack of traversed objects @@ -1750,40 +1806,57 @@ // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary + var othLength = other.length; length = value.length; - size = other.length; - result = size == length; + result = othLength == length; if (result || isWhere) { + var othIndex = -1; + // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - othValue = other[size]; + while (++othIndex < othLength) { + var othValue = other[othIndex]; if (isWhere) { - while (index--) { - if ((result = baseIsEqual(value[index], othValue, callback, isWhere, stackA, stackB))) { + var index = -1; + while (++index < length) { + result = baseIsEqual(value[index], othValue, callback, isWhere, stackA, stackB); + if (result) { break; } } - if (!result) { - break; - } - } else if (!(result = baseIsEqual(value[size], othValue, callback, isWhere, stackA, stackB))) { + } else { + var valValue = value[othIndex]; + result = callback ? callback(valValue, othValue, othIndex) : undefined; + result = typeof result == 'undefined' + ? baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB) + : !!result; + } + if (!result) { break; } } } } else { + var size = 0; + // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly baseForIn(other, function(othValue, key, other) { if (hasOwnProperty.call(other, key)) { - // count the number of properties. + result = false; + // count the number of properties size++; - // deep compare each property value. - return (result = hasOwnProperty.call(value, key) && baseIsEqual(value[key], othValue, callback, isWhere, stackA, stackB)); + // deep compare each property value + if (hasOwnProperty.call(value, key)) { + var valValue = value[key]; + result = callback ? callback(valValue, othValue, key) : undefined; + result = typeof result == 'undefined' + ? baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB) + : !!result; + } + return result; } }); @@ -1792,7 +1865,8 @@ baseForIn(value, function(valValue, key, value) { if (hasOwnProperty.call(value, key)) { // `size` will be `-1` if `value` has more properties than `other` - return (result = --size > -1); + result = --size > -1; + return result; } }); } @@ -1804,8 +1878,32 @@ } /** - * The base implementation of `_.merge` without argument juggling or support - * for `this` binding. + * The base implementation of `_.invoke` which requires additional arguments + * be provided as an array of arguments rather than individually. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|string} methodName The name of the method to invoke or + * the function invoked per iteration. + * @param {Array} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + */ + function baseInvoke(collection, methodName, args) { + var index = -1, + isFunc = typeof methodName == 'function', + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); + + baseEach(collection, function(value) { + var func = isFunc ? methodName : (value != null && value[methodName]); + result[++index] = func ? func.apply(value, args) : undefined; + }); + return result; + } + + /** + * The base implementation of `_.merge` without support for argument juggling, + * multiple sources, and `this` binding. * * @private * @param {Object} object The destination object. @@ -1813,64 +1911,124 @@ * @param {Function} [callback] The function to customize merging properties. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {Object} Returns the destination object. */ function baseMerge(object, source, callback, stackA, stackB) { - (isArray(source) ? arrayEach : baseForOwn)(source, function(source, key) { - var found, - isArr, - result = source, + if (!object) { + return object; + } + (isArray(source) ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { + var isArr = srcValue && isArray(srcValue), + isObj = srcValue && isPlainObject(srcValue), value = object[key]; - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - var isShallow; - if (callback) { - result = callback(value, source); - if ((isShallow = typeof result != 'undefined')) { - value = result; - } - } - if (!isShallow) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!isShallow) { - baseMerge(value, source, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } + if (!(isArr || isObj)) { + result = callback ? callback(value, srcValue, key, object, source) : undefined; + if (typeof result == 'undefined') { + result = srcValue; } if (typeof result != 'undefined') { value = result; } + object[key] = value; + return; + } + // avoid merging previously merged cyclic sources + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == srcValue) { + object[key] = stackB[length]; + return; + } + } + var result = callback ? callback(value, srcValue, key, object, source) : undefined, + isShallow = typeof result != 'undefined'; + + if (isShallow) { + value = result; + } else { + value = isArr + ? (isArray(value) ? value : []) + : (isPlainObject(value) ? value : {}); + } + // add `source` and associated `value` to the stack of traversed objects + stackA.push(srcValue); + stackB.push(value); + + // recursively merge objects and arrays (susceptible to call stack limits) + if (!isShallow) { + baseMerge(value, srcValue, callback, stackA, stackB); } object[key] = value; }); + + return object; } /** - * The base implementation of `_.random` without argument juggling or support - * for returning floating-point numbers. + * The base implementation of `_.pick` without support for `this` binding + * and individual property name arguments. + * + * @private + * @param {Object} object The source object. + * @param {Function|string[]} predicate The function called per iteration or + * property names to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, predicate) { + var result = {}; + + if (typeof predicate == 'function') { + baseForIn(object, function(value, key, object) { + if (predicate(value, key, object)) { + result[key] = value; + } + }); + return result; + } + var index = -1, + props = predicate, + length = props.length; + + while (++index < length) { + var key = props[index]; + if (key in object) { + result[key] = object[key]; + } + } + return result; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * index arguments. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + */ + function basePullAt(array, indexes) { + var length = indexes.length, + result = baseAt(array, indexes); + + indexes.sort(baseCompareAscending); + while (length--) { + var index = parseFloat(indexes[length]); + if (index != previous && index > -1 && index % 1 == 0) { + var previous = index; + splice.call(array, index, 1); + } + } + return result; + } + + /** + * The base implementation of `_.random` without support for argument juggling + * and returning floating-point numbers. * * @private * @param {number} min The minimum possible value. @@ -1883,7 +2041,7 @@ /** * The base implementation of `_.uniq` without support for callback shorthands - * or `this` binding. + * and `this` binding. * * @private * @param {Array} array The array to process. @@ -1964,6 +2122,32 @@ return result; } + /** + * Compiles a function from `source` using the `varNames` and `varValues` + * pairs to import free variables into the compiled function. If `sourceURL` + * is provided it will be used as the sourceURL for the compiled function. + * + * @private + * @param {string} source The source to compile. + * @param {Array} varNames An array of free variable names. + * @param {Array} varValues An array of free variable values. + * @param {string} [sourceURL=''] The sourceURL of the source. + * @returns {Function} Returns the compiled function. + */ + function compileFunction(source, varNames, varValues, sourceURL) { + sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; + try { + // provide the compiled function's source by its `toString` method or + // the `source` property as a convenience for inlining compiled templates + var result = Function(varNames, 'return ' + source + sourceURL).apply(undefined, varValues); + result.source = source; + } catch(e) { + e.source = source; + throw e; + } + return result; + } + /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. @@ -2030,7 +2214,7 @@ * Creates a function that aggregates a collection, creating an accumulator * object composed from the results of running each element in the collection * through a callback. The given setter function sets the keys and values of - * the accumulator object. If `initializer` is provided will be used to + * the accumulator object. If `initializer` is provided it will be used to * initialize the accumulator object. * * @private @@ -2060,6 +2244,41 @@ }; } + /** + * Creates a function that assigns properties of source object(s) to a given + * destination object. + * + * @private + * @param {Function} assigner The function to customize assigning values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return function(object) { + var args = arguments, + length = args.length; + + if (!object || length < 2) { + return object; + } + // enables use as a callback for functions like `_.reduce` + var type = typeof args[2]; + if ((type == 'number' || type == 'string') && args[3] && args[3][args[2]] === args[1]) { + length = 2; + } + // juggle arguments + if (length > 3 && typeof args[length - 2] == 'function') { + var callback = baseCreateCallback(args[--length - 1], args[length--], 2); + } else if (length > 2 && typeof args[length - 1] == 'function') { + callback = args[--length]; + } + var index = 0; + while (++index < length) { + assigner(object, args[index], callback); + } + return object; + }; + } + /** * Creates a cache object to optimize linear searches of large arrays. * @@ -2258,6 +2477,7 @@ var setData = !defineProperty ? noop : function(func, value) { descriptor.value = value; defineProperty(func, expando, descriptor); + descriptor.value = null; }; /** @@ -2987,7 +3207,7 @@ * @memberOf _ * @category Arrays * @param {Array} array The array to modify. - * @param {...(number|number[])} [index] The indexes of values to remove, + * @param {...(number|number[])} [indexes] The indexes of elements to remove, * specified as individual indexes or arrays of indexes. * @returns {Array} Returns the new array of removed elements. * @example @@ -3002,19 +3222,7 @@ * // => [10, 20] */ function pullAt(array) { - var indexes = baseFlatten(arguments, true, false, 1), - length = indexes.length, - result = baseAt(array, indexes); - - indexes.sort(baseCompareAscending); - while (length--) { - var index = parseFloat(indexes[length]); - if (index != previous && index > -1 && index % 1 == 0) { - var previous = index; - splice.call(array, index, 1); - } - } - return result; + return basePullAt(array, baseFlatten(arguments, true, false, 1)); } /** @@ -3121,7 +3329,7 @@ var index = -1, length = array ? array.length : 0; - start = typeof start == 'undefined' ? 0 : (+start || 0); + start = start == null ? 0 : (+start || 0); if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { @@ -3704,8 +3912,8 @@ } /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * Checks if `value` is present in `collection` using strict equality for + * comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the * offset from the end of the collection. * * @static @@ -3834,8 +4042,10 @@ */ function every(collection, predicate, thisArg) { var result = true; - predicate = lodash.createCallback(predicate, thisArg, 3); + if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + predicate = lodash.createCallback(predicate, thisArg, 3); + } if (isArray(collection)) { var index = -1, length = collection.length; @@ -3847,7 +4057,8 @@ } } else { baseEach(collection, function(value, index, collection) { - return (result = !!predicate(value, index, collection)); + result = !!predicate(value, index, collection); + return result; }); } return result; @@ -4049,7 +4260,7 @@ * // => logs each number and returns the object (property order is not guaranteed across environments) */ function forEach(collection, callback, thisArg) { - return (callback && typeof thisArg == 'undefined' && isArray(collection)) + return (typeof callback == 'function' && typeof thisArg == 'undefined' && isArray(collection)) ? arrayEach(collection, callback) : baseEach(collection, baseCreateCallback(callback, thisArg, 3)); } @@ -4072,7 +4283,7 @@ * // => logs each number from right to left and returns '3,2,1' */ function forEachRight(collection, callback, thisArg) { - return (callback && typeof thisArg == 'undefined' && isArray(collection)) + return (typeof callback == 'function' && typeof thisArg == 'undefined' && isArray(collection)) ? arrayEachRight(collection, callback) : baseEachRight(collection, baseCreateCallback(callback, thisArg, 3)); } @@ -4175,7 +4386,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|string} methodName The name of the method to invoke or * the function invoked per iteration. - * @param {...*} [args] Arguments to invoke the method with. + * @param {...*} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. * @example * @@ -4186,17 +4397,7 @@ * // => [['1', '2', '3'], ['4', '5', '6']] */ function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection && collection.length, - result = Array(length < 0 ? 0 : length >>> 0); - - baseEach(collection, function(value) { - var func = isFunc ? methodName : (value != null && value[methodName]); - result[++index] = func ? func.apply(value, args) : undefined; - }); - return result; + return baseInvoke(collection, methodName, slice(arguments, 2)); } /** @@ -4740,8 +4941,10 @@ */ function some(collection, predicate, thisArg) { var result; - predicate = lodash.createCallback(predicate, thisArg, 3); + if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + predicate = lodash.createCallback(predicate, thisArg, 3); + } if (isArray(collection)) { var index = -1, length = collection.length; @@ -4753,7 +4956,8 @@ } } else { baseEach(collection, function(value, index, collection) { - return !(result = predicate(value, index, collection)); + result = predicate(value, index, collection); + return !result; }); } return !!result; @@ -4944,7 +5148,7 @@ * @category Functions * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * @@ -4981,8 +5185,8 @@ * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodNames] The object method names to bind, specified - * as individual method names or arrays of method names. + * @param {...(string|string[])} [methodNames] The object method names to bind, + * specified as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * @@ -4996,12 +5200,26 @@ * // => logs 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; + return baseBindAll(object, arguments.length > 1 + ? baseFlatten(arguments, true, false, 1) + : functions(object)); + } + + /** + * The base implementation of `_.bindAll` without support for individual + * method name arguments. + * + * @private + * @param {Object} object The object to bind and assign the bound methods to. + * @param {string[]} methodNames The object method names to bind. + * @returns {Object} Returns `object`. + */ + function baseBindAll(object, methodNames) { + var index = -1, + length = methodNames.length; while (++index < length) { - var key = funcs[index]; + var key = methodNames[index]; object[key] = createWrapper(object[key], BIND_FLAG, null, object); } return object; @@ -5020,7 +5238,7 @@ * @category Functions * @param {Object} object The object the method belongs to. * @param {string} key The key of the method. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * @@ -5284,7 +5502,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to defer. - * @param {...*} [args] Arguments to invoke the function with. + * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * @@ -5308,7 +5526,7 @@ * @category Functions * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [args] Arguments to invoke the function with. + * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * @@ -5453,7 +5671,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * @@ -5483,7 +5701,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * @@ -5589,8 +5807,8 @@ * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). + * assigned values. The callback is bound to `thisArg` and invoked with + * five arguments; (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ @@ -5613,45 +5831,14 @@ * defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' }); * // => { 'name': 'barney', 'employer': 'slate' } */ - function assign(object, source, guard) { - var args = arguments; - if (!object || args.length < 2) { - return object; - } - var argsIndex = 0, - argsLength = args.length, - type = typeof guard; - - // enables use as a callback for functions like `_.reduce` - if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { - argsLength = 2; - } - // juggle arguments - if (argsLength > 3 && typeof args[argsLength - 2] == 'function') { - var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2); - } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') { - callback = args[--argsLength]; - } - while (++argsIndex < argsLength) { - source = args[argsIndex]; - var index = -1, - props = keys(source), - length = props.length; - - while (++index < length) { - var key = props[index]; - object[key] = callback ? callback(object[key], source[key]) : source[key]; - } - } - return object; - } + var assign = createAssigner(baseAssign); /** * Creates a clone of `value`. If `isDeep` is `true` nested objects will also * be cloned, otherwise they will be assigned by reference. If a callback * is provided it will be executed to produce the cloned values. If the * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). + * The callback is bound to `thisArg` and invoked with two argument; (value, index|key). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -5714,7 +5901,7 @@ * Creates a deep clone of `value`. If a callback is provided it will be * executed to produce the cloned values. If the callback returns `undefined` * cloning will be handled by the method instead. The callback is bound to - * `thisArg` and invoked with one argument; (value). + * `thisArg` and invoked with two argument; (value, index|key). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -5790,7 +5977,7 @@ */ function create(prototype, properties) { var result = baseCreate(prototype); - return properties ? assign(result, properties) : result; + return properties ? baseAssign(result, properties) : result; } /** @@ -5942,7 +6129,9 @@ * // => logs 'x', 'y', and 'z' (property order is not guaranteed across environments) */ function forIn(object, callback, thisArg) { - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof callback != 'function' || typeof thisArg != 'undefined') { + callback = baseCreateCallback(callback, thisArg, 3); + } return baseFor(object, callback, keysIn); } @@ -5997,7 +6186,9 @@ * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) */ function forOwn(object, callback, thisArg) { - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof callback != 'function' || typeof thisArg != 'undefined') { + callback = baseCreateCallback(callback, thisArg, 3); + } return baseForOwn(object, callback); } @@ -6268,7 +6459,8 @@ return !length; } baseForOwn(value, function() { - return (result = false); + result = false; + return result; }); return result; } @@ -6278,7 +6470,7 @@ * equivalent. If a callback is provided it will be executed to compare * values. If the callback returns `undefined` comparisons will be handled * by the method instead. The callback is bound to `thisArg` and invoked - * with two arguments; (value, other). + * with three arguments; (value, other, key). * * Note: This method supports comparing arrays, booleans, `Date` objects, * numbers, `Object` objects, regexes, and strings. Functions and DOM nodes @@ -6404,7 +6596,9 @@ * // => false */ function isFunction(value) { - return typeof value == 'function'; + // avoid a Chakra bug in IE 11 + // https://github.com/jashkenas/underscore/issues/1621 + return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { @@ -6417,6 +6611,8 @@ * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * + * Note: See the [ES5 spec](http://es5.github.io/#x8) for more details. + * * @static * @memberOf _ * @category Objects @@ -6434,9 +6630,7 @@ * // => false */ function isObject(value) { - // check if the value is the ECMAScript language type of `Object` - // http://es5.github.io/#x8 - // and avoid a V8 bug + // avoid a V8 bug in Chrome 19-20 // https://code.google.com/p/v8/issues/detail?id=2291 var type = typeof value; return type == 'function' || (value && type == 'object') || false; @@ -6782,7 +6976,7 @@ * provided it will be executed to produce the merged values of the destination * and source properties. If the callback returns `undefined` merging will * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). + * invoked with five arguments; (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ @@ -6826,34 +7020,7 @@ * }); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } */ - function merge(object, source, guard) { - var args = arguments, - length = args.length, - type = typeof guard; - - if (!object || length < 2) { - return object; - } - // enables use as a callback for functions like `_.reduce` - if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { - length = 2; - } - // juggle arguments - if (length > 3 && typeof args[length - 2] == 'function') { - var callback = baseCreateCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - var sources = slice(args, 1, length), - index = -1, - stackA = [], - stackB = []; - - while (++index < length) { - baseMerge(object, sources[index], callback, stackA, stackB); - } - return object; - } + var merge = createAssigner(baseMerge); /** * Creates a shallow clone of `object` excluding the specified properties. @@ -6883,9 +7050,11 @@ * // => { 'name': 'fred' } */ function omit(object, predicate, thisArg) { + if (!isObject(object)) { + return {}; + } if (typeof predicate == 'function') { - predicate = lodash.createCallback(predicate, thisArg, 3); - return pick(object, negate(predicate)); + return basePick(object, negate(lodash.createCallback(predicate, thisArg, 3))); } var omitProps = baseFlatten(arguments, true, false, 1), length = omitProps.length; @@ -6893,7 +7062,7 @@ while (length--) { omitProps[length] = String(omitProps[length]); } - return pick(object, baseDifference(keysIn(object), omitProps)); + return basePick(object, baseDifference(keysIn(object), omitProps)); } /** @@ -6951,28 +7120,12 @@ * // => { 'name': 'fred' } */ function pick(object, predicate, thisArg) { - var result = {}; - - if (typeof predicate != 'function') { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - predicate = lodash.createCallback(predicate, thisArg, 3); - baseForIn(object, function(value, key, object) { - if (predicate(value, key, object)) { - result[key] = value; - } - }); + if (!isObject(object)) { + return {}; } - return result; + return basePick(object, typeof predicate == 'function' + ? lodash.createCallback(predicate, thisArg, 3) + : baseFlatten(arguments, true, false, 1)); } /** @@ -7420,7 +7573,7 @@ * settings object is provided it will override `_.templateSettings` for the * template. * - * Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging. + * Note: In the development build, `_.template` utilizes sourceURLs for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * @@ -7438,9 +7591,9 @@ * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The HTML "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. + * @param {Object} [options.imports] An object to import into the template as free variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source. + * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @returns {Function|string} Returns the interpolated string if a data object * is provided, else the compiled template function. @@ -7478,7 +7631,7 @@ * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); * // => '
  • fred
  • barney
  • ' * - * // using the `sourceURL` option to specify a custom `sourceURL` for the template + * // using the `sourceURL` option to specify a custom sourceURL for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector @@ -7506,10 +7659,10 @@ // and Laura Doktorova's doT.js // https://github.com/olado/doT var settings = lodash.templateSettings; - options = defaults({}, options, settings); + options = assign({}, options, settings, assignOwnDefaults); string = String(string == null ? '' : string); - var imports = defaults({}, options.imports, settings.imports), + var imports = assign({}, options.imports, settings.imports, assignOwnDefaults), importsKeys = keys(imports), importsValues = values(imports); @@ -7584,24 +7737,12 @@ source + 'return __p\n}'; - // Use a `sourceURL` for easier debugging. + // use a sourceURL for easier debugging // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; + var sourceURL = options.sourceURL || ('/lodash/template/source[' + (templateCounter++) + ']'), + result = compileFunction(source, importsKeys, importsValues, sourceURL); - try { - var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues); - } catch(e) { - e.source = source; - throw e; - } - if (data) { - return result(data); - } - // provide the compiled function's source by its `toString` method, in - // supported environments, or the `source` property as a convenience for - // inlining compiled templates during the build process - result.source = source; - return result; + return data ? result(data) : result; } /** @@ -7852,10 +7993,14 @@ * // => [{ 'name': 'fred', 'age': 40 }] */ function createCallback(func, thisArg, argCount) { - var type = typeof func; - if (type == 'function' || func == null) { - return (typeof thisArg == 'undefined' || !(func && 'prototype' in func)) && - func || baseCreateCallback(func, thisArg, argCount); + var type = typeof func, + isFunc = type == 'function'; + + if (isFunc && (typeof thisArg == 'undefined' || !('prototype' in func))) { + return func; + } + if (isFunc || func == null) { + return baseCreateCallback(func, thisArg, argCount); } // handle "_.pluck" and "_.where" style callback shorthands return type == 'object' ? matches(func) : property(func); @@ -7927,15 +8072,14 @@ if (length && !object) { return false; } - var result = true; while (length--) { var key = props[length]; - if (!(result = hasOwnProperty.call(object, key) && - baseIsEqual(object[key], source[key], null, true))) { - break; + if (!(hasOwnProperty.call(object, key) && + baseIsEqual(object[key], source[key], null, true))) { + return false; } } - return result; + return true; }; } @@ -8298,7 +8442,7 @@ * @returns {Array} Returns the array of results. * @example * - * var diceRolls = _.times(3, _.partial(_.random, 1, 6)); + * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false)); * // => [3, 6, 4] * * _.times(3, function(n) { mage.castSpell(n); }); @@ -8441,7 +8585,7 @@ lodash.unzip = zip; // add functions to `lodash.prototype` - mixin(lodash, assign({}, lodash)); + mixin(lodash, baseAssign({}, lodash)); /*--------------------------------------------------------------------------*/ @@ -8521,7 +8665,7 @@ lodash.inject = reduce; mixin(lodash, (function() { - var source = {} + var source = {}; baseForOwn(lodash, function(func, methodName) { if (!lodash.prototype[methodName]) { source[methodName] = func; @@ -8545,9 +8689,9 @@ lodash.head = first; baseForOwn(lodash, function(func, methodName) { - var callbackable = methodName !== 'sample'; + var callbackable = methodName != 'sample'; if (!lodash.prototype[methodName]) { - lodash.prototype[methodName]= function(n, guard) { + lodash.prototype[methodName] = function(n, guard) { var chainAll = this.__chain__, result = func(this.__wrapped__, n, guard); @@ -8578,7 +8722,7 @@ // add `Array` functions that return unwrapped values arrayEach(['join', 'pop', 'shift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { var chainAll = this.__chain__, result = func.apply(this.__wrapped__, arguments); @@ -8591,7 +8735,7 @@ // add `Array` functions that return the existing wrapped value arrayEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -8600,7 +8744,7 @@ // add `Array` functions that return new wrapped values arrayEach(['concat', 'splice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__); }; @@ -8610,7 +8754,7 @@ // in IE < 9, Firefox < 10, Narwhal, and RingoJS if (!support.spliceObjects) { arrayEach(['pop', 'shift', 'splice'], function(methodName) { - var func = arrayRef[methodName], + var func = arrayProto[methodName], isSplice = methodName == 'splice'; lodash.prototype[methodName] = function() { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 3ea1cb76f..faeb5016e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,68 +3,68 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Br(e);++ra(t,l)&&f.push(l);return f}function wt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1i(s,g)&&((r||f)&&s.push(g),c.push(p))}return c}function Lt(n,t){for(var r=-1,e=t(n),u=e.length,o=Br(u);++ro?0:o)}function Vt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?Oe(u+r,0):r||0;else if(r)return r=Ht(n,t),u&&n[r]===t?r:-1;return e(n,t,r) -}function Jt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else o=null==t||r?1:t;return o=e-(o||0),Gt(n,0,0>o?0:o)}function Xt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:b;return o=e-(o||0),Gt(n,0>o?0:o)}function Yt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Gt(n,o)}function Gt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=Oe(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=Oe(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Br(u);++e>>1,r(n[e])r?0:r);++tr?Oe(e+r,0):r||0:0,typeof n=="string"||!De(n)&&Ar(n)?ru&&(u=i)}else t=null==t&&Ar(n)?o:U.createCallback(t,r,3),wt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n) -});return u}function sr(n,t){return fr(n,Dr(t))}function pr(n,t,r,e){var u=3>arguments.length;if(t=U.createCallback(t,e,4),De(n)){var o=-1,a=n.length;for(u&&a&&(r=n[++o]);++oarguments.length;return t=U.createCallback(t,e,4),xt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function hr(n){var t=-1,r=n&&n.length,e=Br(0>r?0:r>>>0);return wt(n,function(n){var r=Tt(0,++t);e[t]=e[r],e[r]=n}),e}function vr(n,t,r){var e; -if(t=U.createCallback(t,r,3),De(n)){r=-1;for(var u=n.length;++rarguments.length)return zt(n,_,null,t);if(n)var r=n[E]?n[E][2]:n.length,e=Gt(arguments,2),r=r-e.length;return zt(n,_|j,r,t,e)}function mr(n,t,r){var e,u,o,a,i,l,f,c=0,s=false,p=true;if(!jr(n))throw new Gr(A);if(t=0>t?0:t,true===r)var g=true,p=false;else kr(r)&&(g=r.leading,s="maxWait"in r&&Oe(t,+r.maxWait||0),p="trailing"in r?r.trailing:p); -var h=function(){var r=t-(Me()-a);0>=r||r>t?(u&&le(u),r=f,u=l=f=b,r&&(c=Me(),o=n.apply(i,e),l||u||(e=i=null))):l=ye(h,r)},v=function(){l&&le(l),u=l=f=b,(p||s!==t)&&(c=Me(),o=n.apply(i,e),l||u||(e=i=null))};return function(){if(e=arguments,a=Me(),i=this,f=p&&(l||!g),false===s)var r=g&&!l;else{u||g||(c=a);var y=s-(a-c),m=0>=y||y>s;m?(u&&(u=le(u)),c=a,o=n.apply(i,e)):u||(u=ye(v,y))}return m&&l?l=le(l):l||t===s||(l=ye(h,t)),r&&(m=true,o=n.apply(i,e)),!m||l||u||(e=i=null),o}}function dr(n){if(!jr(n))throw new Gr(A); -return function(){return!n.apply(this,arguments)}}function br(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,a=typeof r;if("number"!=a&&"string"!=a||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,o=e&&n===e.prototype,a=r-1,e=Br(r),i=0t||null==n||!Ce(t))return r;n=Yr(n);do t%2&&(r+=n),t=fe(t/2),n+=n;while(t); -return r}function Fr(n,t){return(n=null==n?"":Yr(n))?null==t?n.slice(v(n),y(n)+1):(t=Yr(t),n.slice(a(n,t),i(n,t)+1)):n}function Lr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||mt(n,t,r):"object"==e?$r(n):Dr(n)}function Wr(n){return n}function $r(n){var t=qe(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||kr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=pe.call(e,o)&&Rt(e[o],n[o],null,true)););return o}:function(n){return n&&pe.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false -}}function Pr(n,t,r){var e=true,u=t&&It(t,qe);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=It(t,qe)),false===r?e=false:kr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=jr(n),a=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},U.assign=br,U.at=function(n){return Te.unindexedChars&&Ar(n)&&(n=n.split("")),t(n,jt(arguments,true,false,1))},U.bind=yr,U.bindAll=function(n){for(var t=1arguments.length?zt(t,_|w,null,n):zt(t,_|w|j,null,n,Gt(arguments,2))},U.chain=function(n){return new J(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?u(p,l):a(s,l))){for(t=r;--t;){var g=o[t];if(0>(g?u(g,l):a(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},U.invert=function(n,t){for(var r=-1,e=qe(n),u=e.length,o={};++ro?0:o>>>0);return wt(n,function(n){var o=u?t:null!=n&&n[t];a[++e]=o?o.apply(n,r):b}),a},U.keys=qe,U.keysIn=Sr,U.map=fr,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u)}),e},U.matches=$r,U.max=cr,U.memoize=function(n,t){if(!jr(n)||t&&!jr(t))throw new Gr(A);var r=function(){var e=t?t.apply(this,arguments):arguments[0]; -if("__proto__"==e)return n.apply(this,arguments);var u=r.cache;return pe.call(u,e)?u[e]:u[e]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0); -for(o||(t=U.createCallback(t,r,3)),wt(n,function(n,r,u){if(o)for(r=t.length,u=Br(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);a[++e]={a:u,b:e,c:n}}),u=a.length,a.sort(o?f:l);u--;)a[u]=a[u].c;return a},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!jr(n))throw new Gr(A);return false===r?e=false:kr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,mr(n,t,ft)},U.times=function(n,t,r){n=0>n?0:n>>>0,t=mt(t,r,1),r=-1; -for(var e=Br(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Yr(n).replace(L,p)},U.escapeRegExp=Nr,U.every=ur,U.find=ar,U.findIndex=Kt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,At,true) -},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,xt)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,St,true)},U.findWhere=function(n,t){return ar(n,$r(t))},U.has=function(n,t){return n?pe.call(n,t):false},U.identity=Wr,U.indexOf=Vt,U.isArguments=xr,U.isArray=De,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&oe.call(n)==nt||false -},U.isDate=function(n){return n&&typeof n=="object"&&oe.call(n)==tt||false},U.isElement=Cr,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?Oe(e+r,0):Ee(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return s._=ee,this},U.noop=zr,U.now=Me,U.pad=function(n,t,r){n=null==n?"":Yr(n),t=+t; -var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=_r({},r,e),n=Yr(null==n?"":n);var u,o,a=_r({},r.imports,e.imports),e=qe(a),a=Rr(a),i=0,l=r.interpolate||Z,f="__p+='",l=Xr((r.escape||Z).source+"|"+l.source+"|"+(l===P?z:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); -n.replace(l,function(t,r,e,a,l,c){return e||(e=a),f+=n.slice(i,c).replace(V,g),r&&(u=true,f+="'+__e("+r+")+'"),l&&(o=true,f+="';"+l+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';",(r=r.variable)||(f="with(obj){"+f+"}"),f=(o?f.replace(R,""):f).replace(N,"$1").replace(T,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=Kr(e,"return "+f).apply(b,a) -}catch(s){throw s.source=f,s}return t?c(t):(c.source=f,c)},U.trim=Fr,U.trimLeft=function(n,t){return(n=null==n?"":Yr(n))?null==t?n.slice(v(n)):(t=Yr(t),n.slice(a(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Yr(n))?null==t?n.slice(0,y(n)+1):(t=Yr(t),n.slice(0,i(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&kr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Yr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Yr(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(Er(u)){if(n.slice(o).search(u)){var a,i,l=n.slice(0,o);for(u.global||(u=Xr(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;a=u.exec(l);)i=a.index;r=r.slice(0,null==i?o:i)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(F,m))},U.uniqueId=function(n){var t=++S;return Yr(null==n?"":n)+t},U.all=ur,U.any=vr,U.detect=ar,U.foldl=pr,U.foldr=gr,U.include=er,U.inject=pr,Pr(U,function(){var n={}; -return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Mt,U.last=Xt,U.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Rr(n):Te.unindexedChars&&Ar(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Mt,U.takeRight=Xt,U.takeRightWhile=Xt,U.takeWhile=Mt,U.head=Mt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.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 J(o,u):o -})}),U.VERSION=O,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=rr,U.prototype.toString=function(){return Yr(this.__wrapped__)},U.prototype.value=rr,U.prototype.valueOf=rr,st(["join","pop","shift"],function(n){var t=Hr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new J(r,n):r}}),st(["push","reverse","sort","unshift"],function(n){var t=Hr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} -}),st(["concat","splice"],function(n){var t=Hr[n];U.prototype[n]=function(){return new J(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Te.spliceObjects||st(["pop","shift","splice"],function(n){var t=Hr[n],r="splice"==n;U.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 J(u,n):u}}),U}var b,_=1,w=2,x=4,C=8,j=16,k=32,O="2.4.1",E="__lodash@"+O+"__",A="Expected a function",S=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,T=/(__e\(.*?\)|\b__t\))\+'';/g,F=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,W=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,P=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,K=/[.*+?^${}()|[\]\/\\]/g,M=/\bthis\b/,V=/['\n\r\u2028\u2029\\]/g,J=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,X=" \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",Y="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),H="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",at="[object RegExp]",it="[object String]",lt={}; -lt[et]=false,lt[H]=lt[Q]=lt[nt]=lt[tt]=lt[ut]=lt[ot]=lt[at]=lt[it]=true;var ft={leading:false,maxWait:0,trailing:false},ct={configurable:false,enumerable:false,value:null,writable:false},st={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},gt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},ht={"function":true,object:true},vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},yt=ht[typeof window]&&window||this,mt=ht[typeof exports]&&exports&&!exports.nodeType&&exports,ht=ht[typeof module]&&module&&!module.nodeType&&module,dt=mt&&ht&&typeof global=="object"&&global; -!dt||dt.global!==dt&&dt.window!==dt&&dt.self!==dt||(yt=dt);var dt=ht&&ht.exports===mt&&mt,bt=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yt._=bt, define(function(){return bt})):mt&&ht?dt?(ht.exports=bt)._=bt:mt._=bt:yt._=bt}).call(this); \ No newline at end of file +;(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||8202>>0:0,u=Zr(e);++ri(t,l)&&f.push(l);return f}function Ct(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1o?0:o>>>0); +return Ct(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):m}),i}function Ft(n,t,r,e,u){return n?((Ze(t)?ct:It)(t,function(t,o,i){var a=t&&Ze(t),l=t&&Ke(t),f=n[o];if(a||l){for(e||(e=[]),u||(u=[]),l=e.length;l--;)if(e[l]==t)return void(n[o]=u[l]);i=r?r(f,t,o,n,i):m,f=(l=typeof i!="undefined")?i:a?Ze(f)?f:[]:Ke(f)?f:{},e.push(t),u.push(f),l||Ft(f,t,r,e,u)}else i=r?r(f,t,o,n,i):m,typeof i=="undefined"&&(i=t),typeof i!="undefined"&&(f=i);n[o]=f}),n):n}function Wt(n,t){var r={};if(typeof t=="function")return St(n,function(n,e,u){t(n,e,u)&&(r[e]=n) +}),r;for(var e=-1,u=t.length;++ea(s,g)&&((u||f)&&s.push(g),c.push(p))}return c}function Dt(n,t){for(var r=-1,e=t(n),u=e.length,o=Zr(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3o?0:o)}function Qt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?Se(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 nr(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else o=null==t||r?1:t;return o=e-(o||0),er(n,0,0>o?0:o)}function tr(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:m;return o=e-(o||0),er(n,0>o?0:o)}function rr(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return er(n,o)}function er(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=Se(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=Se(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Zr(u);++e>>1,r(n[e])r?0:r);++tr?Se(e+r,0):r||0:0,typeof n=="string"||!Ze(n)&&Nr(n)?ro&&(o=a)}else t=null==t&&Nr(n)?u:U.createCallback(t,r,3),Ct(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)});return o}function dr(n,t){return vr(n,qr(t))}function mr(n,t,r,e){var u=3>arguments.length;if(t=U.createCallback(t,e,4),Ze(n)){var o=-1,i=n.length;for(u&&i&&(r=n[++o]);++oarguments.length;return t=U.createCallback(t,e,4),jt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o) +}),r}function _r(n){var t=-1,r=n&&n.length,e=Zr(0>r?0:r>>>0);return Ct(n,function(n){var r=$t(0,++t);e[t]=e[r],e[r]=n}),e}function wr(n,t,r){var e;if((typeof t!="function"||typeof r!="undefined")&&(t=U.createCallback(t,r,3)),Ze(n)){r=-1;for(var u=n.length;++rarguments.length)return Kt(n,b,null,t);if(n)var r=n[O]?n[O][2]:n.length,e=er(arguments,2),r=r-e.length;return Kt(n,b|C,r,t,e)}function Cr(n,t,r){var e,u,o,i,a,l,f,c=0,s=false,p=true; +if(!Ar(n))throw new ne(E);if(t=0>t?0:t,true===r)var g=true,p=false;else Sr(r)&&(g=r.leading,s="maxWait"in r&&Se(t,+r.maxWait||0),p="trailing"in r?r.trailing:p);var h=function(){var r=t-(Ge()-i);0>=r||r>t?(u&&se(u),r=f,u=l=f=m,r&&(c=Ge(),o=n.apply(a,e),l||u||(e=a=null))):l=be(h,r)},v=function(){l&&se(l),u=l=f=m,(p||s!==t)&&(c=Ge(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Ge(),a=this,f=p&&(l||!g),false===s)var r=g&&!l;else{u||g||(c=i);var y=s-(i-c),d=0>=y||y>s;d?(u&&(u=se(u)),c=i,o=n.apply(a,e)):u||(u=be(v,y)) +}return d&&l?l=se(l):l||t===s||(l=be(h,t)),r&&(d=true,o=n.apply(a,e)),!d||l||u||(e=a=null),o}}function jr(n){if(!Ar(n))throw new ne(E);return function(){return!n.apply(this,arguments)}}function kr(n){return Nt(n,Tr)}function Or(n){return n&&typeof n=="object"&&typeof n.length=="number"&&le.call(n)==G||false}function Er(n){return n&&typeof n=="object"&&1===n.nodeType&&(We.nodeClass?-1>>0,e=n.constructor,u=-1,o=e&&n===e.prototype,i=r-1,e=Zr(r),a=0t||null==n||!Oe(t))return r;n=Qr(n);do t%2&&(r+=n),t=pe(t/2),n+=n;while(t);return r}function $r(n,t){return(n=null==n?"":Qr(n))?null==t?n.slice(h(n),v(n)+1):(t=Qr(t),n.slice(o(n,t),i(n,t)+1)):n +}function Pr(n,t,r){var e=typeof n,u="function"==e;return!u||typeof t!="undefined"&&"prototype"in n?u||null==n?_t(n,t,r):"object"==e?zr(n):qr(n):n}function Dr(n){return n}function zr(n){var t=Me(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||Sr(u)?function(e){var u=r;if(u&&!e)return false;for(;u--;){var o=t[u];if(!ve.call(e,o)||!Tt(e[o],n[o],null,true))return false}return true}:function(n){return n&&ve.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function Br(n,t,r){var e=true,u=t&&Nt(t,Me);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Nt(t,Me)),false===r?e=false:Sr(r)&&"chain"in r&&(e=r.chain),r=-1; +for(var o=Ar(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},U.assign=qe,U.at=function(t){return We.unindexedChars&&Nr(t)&&(t=t.split("")),n(t,Ot(arguments,true,false,1))},U.bind=xr,U.bindAll=function(n){for(var t=n,r=1arguments.length?Kt(t,b|_,null,n):Kt(t,b|_|C,null,n,er(arguments,2))},U.chain=function(n){return new V(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?e(p,l):i(s,l))){for(t=u;--t;){var g=o[t]; +if(0>(g?e(g,l):i(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},U.invert=function(n,t){for(var r=-1,e=Me(n),u=e.length,o={};++ru?0:u>>>0);for(o||(t=U.createCallback(t,r,3)),Ct(n,function(n,r,u){if(o)for(r=t.length,u=Zr(r);r--;)u[r]=n[t[r]]; +else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?l:a);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!Ar(n))throw new ne(E);return false===r?e=false:Sr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),lt.leading=e,lt.maxWait=+t,lt.trailing=u,Cr(n,t,lt)},U.times=function(n,t,r){n=0>n?0:n>>>0,t=_t(t,r,1),r=-1;for(var e=Zr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Qr(n).replace(L,s)},U.escapeRegExp=Fr,U.every=cr,U.find=pr,U.findIndex=Gt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),kt(n,t,It,true)},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),kt(n,t,jt) +},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),kt(n,t,Rt,true)},U.findWhere=function(n,t){return pr(n,zr(t))},U.has=function(n,t){return n?ve.call(n,t):false},U.identity=Dr,U.indexOf=Qt,U.isArguments=Or,U.isArray=Ze,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&le.call(n)==Q||false},U.isDate=function(n){return n&&typeof n=="object"&&le.call(n)==nt||false +},U.isElement=Er,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?Se(e+r,0):Ie(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return c._=ie,this},U.noop=Ur,U.now=Ge,U.pad=function(n,t,r){n=null==n?"":Qr(n),t=+t;var e=n.length; +return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=qe({},r,e,gt),n=Qr(null==n?"":n);var u,o,i=qe({},r.imports,e.imports,gt),e=Me(i),i=Lr(i),a=0,l=r.interpolate||q,f="__p+='",l=Hr((r.escape||q).source+"|"+l.source+"|"+(l===$?P:q).source+"|"+(r.evaluate||q).source+"|$","g"); +return n.replace(l,function(t,r,e,i,l,c){return e||(e=i),f+=n.slice(a,c).replace(M,p),r&&(u=true,f+="'+__e("+r+")+'"),l&&(o=true,f+="';"+l+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),f+="';",(r=r.variable)||(f="with(obj){"+f+"}"),f=(o?f.replace(I,""):f).replace(R,"$1").replace(N,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}",r=zt(f,e,i,void 0),t?r(t):r +},U.trim=$r,U.trimLeft=function(n,t){return(n=null==n?"":Qr(n))?null==t?n.slice(h(n)):(t=Qr(t),n.slice(o(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Qr(n))?null==t?n.slice(0,v(n)+1):(t=Qr(t),n.slice(0,i(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&Sr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Qr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Qr(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(Rr(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Hr(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)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(T,y))},U.uniqueId=function(n){var t=++A;return Qr(null==n?"":n)+t},U.all=cr,U.any=wr,U.detect=pr,U.foldl=mr,U.foldr=br,U.include=fr,U.inject=mr,Br(U,function(){var n={};return It(U,function(t,r){U.prototype[r]||(n[r]=t) +}),n}(),false),U.first=Ht,U.last=tr,U.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Lr(n):We.unindexedChars&&Nr(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Ht,U.takeRight=tr,U.takeRightWhile=tr,U.takeWhile=Ht,U.head=Ht,It(U,function(n,t){var r="sample"!=t;U.prototype[t]||(U.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 V(o,u):o}) +}),U.VERSION=k,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=lr,U.prototype.toString=function(){return Qr(this.__wrapped__)},U.prototype.value=lr,U.prototype.valueOf=lr,ct(["join","pop","shift"],function(n){var t=te[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),ct(["push","reverse","sort","unshift"],function(n){var t=te[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ct(["concat","splice"],function(n){var t=te[n]; +U.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments),this.__chain__)}}),We.spliceObjects||ct(["pop","shift","splice"],function(n){var t=te[n],r="splice"==n;U.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 V(u,n):u}}),U}var m,b=1,_=2,w=4,x=8,C=16,j=32,k="2.4.1",O="__lodash@"+k+"__",E="Expected a function",A=0,S=/^[A-Z]+$/,I=/\b__p\+='';/g,R=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,F=/<%-([\s\S]+?)%>/g,W=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,B=/^0[xX]/,U=/[\xC0-\xFF]/g,q=/($^)/,Z=/[.*+?^${}()|[\]\/\\]/g,K=/\bthis\b/,M=/['\n\r\u2028\u2029\\]/g,V=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,J=" \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",X="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="[object Arguments]",H="[object Array]",Q="[object Boolean]",nt="[object Date]",tt="[object Error]",rt="[object Function]",et="[object Number]",ut="[object Object]",ot="[object RegExp]",it="[object String]",at={}; +at[rt]=false,at[G]=at[H]=at[Q]=at[nt]=at[et]=at[ut]=at[ot]=at[it]=true;var lt={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},ct={"&":"&","<":"<",">":">",'"':""","'":"'"},st={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},gt={"function":true,object:true},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vt=gt[typeof window]&&window||this,yt=gt[typeof exports]&&exports&&!exports.nodeType&&exports,gt=gt[typeof module]&&module&&!module.nodeType&&module,dt=yt&>&&typeof global=="object"&&global; +!dt||dt.global!==dt&&dt.window!==dt&&dt.self!==dt||(vt=dt);var dt=gt&>.exports===yt&&yt,mt=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(vt._=mt, define(function(){return mt})):yt&>?dt?(gt.exports=mt)._=mt:yt._=mt:vt._=mt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index b0b568a55..7611f17dd 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -85,7 +85,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to match words to create compound words */ - var reWords = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g; + var reWords = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g; /** Used to detect and test whitespace */ var whitespace = ( @@ -106,7 +106,7 @@ 'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError' ]; - /** Used to make template `sourceURL`s easier to identify */ + /** Used to make template sourceURLs easier to identify */ var templateCounter = 0; /** `Object#toString` result shortcuts */ @@ -232,24 +232,12 @@ /*--------------------------------------------------------------------------*/ /** - * Used by `_.defaults` to customize its `_.assign` use. - * - * @private - * @param {*} objectValue The destination object property value. - * @param {*} sourceValue The source object property value. - * @returns {*} Returns the value to assign to the destination object. - */ - function assignDefaults(objectValue, sourceValue) { - return typeof objectValue == 'undefined' ? sourceValue : objectValue; - } - - /** - * The base implementation of `_.at` without support for strings or individual - * key arguments. + * The base implementation of `_.at` without support for strings and + * individual key arguments. * * @private * @param {Array|Object} collection The collection to iterate over. - * @param {number[]|string[]} [keys] The keys of elements to pick. + * @param {number[]|string[]} [props] The keys of elements to pick. * @returns {Array} Returns the new array of picked elements. */ function baseAt(collection, props) { @@ -533,6 +521,21 @@ * @category Utilities * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. + * @example + * + * var lodash = _.runInContext(); + * + * lodash.mixin({ + * 'exists': function(value) { + * return value != null; + * } + * }, false); + * + * _.isFunction(lodash.exists); + * // => true + * + * _.isFunction(_.exists); + * // => false */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named @@ -554,7 +557,7 @@ TypeError = context.TypeError; /** Used for native method references */ - var arrayRef = Array.prototype, + var arrayProto = Array.prototype, objectProto = Object.prototype, stringProto = String.prototype; @@ -587,12 +590,12 @@ fnToString = Function.prototype.toString, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayRef.push, + push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, - splice = arrayRef.splice, - unshift = arrayRef.unshift; + splice = arrayProto.splice, + unshift = arrayProto.unshift; /** Used to set metadata on functions */ var defineProperty = (function() { @@ -906,6 +909,62 @@ return result; } + /** + * Used by `_.defaults` to customize its `_.assign` use. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignDefaults(objectValue, sourceValue) { + return typeof objectValue == 'undefined' ? sourceValue : objectValue; + } + + /** + * Used by `_.template` to customize its `_.assign` use. + * + * Note: This method is like `assignDefaults` except that it ignores + * inherited property values when checking if a property is `undefined`. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @param {string} key The key associated with the object and source values. + * @param {Object} object The destination object. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignOwnDefaults(objectValue, sourceValue, key, object) { + return (!hasOwnProperty.call(object, key) || typeof objectValue == 'undefined') + ? sourceValue + : objectValue + } + + /** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `this` binding. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} [callback] The function to customize assigning values. + * @returns {Object} Returns the destination object. + */ + function baseAssign(object, source, callback) { + if (!object) { + return object; + } + var index = -1, + props = keys(source), + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = callback ? callback(object[key], source[key], key, object, source) : source[key]; + } + return object; + } + /** * The base implementation of `_.bind` that creates the bound function and * sets its metadata. @@ -926,12 +985,11 @@ if (partialArgs) { // avoid `arguments` object use disqualifying optimizations by // converting it to an array before passing it to `composeArgs` - var index = -1, - length = arguments.length, + var length = arguments.length, args = Array(length); - while (++index < length) { - args[index] = arguments[index]; + while (length--) { + args[length] = arguments[length]; } args = composeArgs(partialArgs, partialHolders, args); } @@ -951,8 +1009,8 @@ } /** - * The base implementation of `_.clone` without argument juggling or support - * for `this` binding. + * The base implementation of `_.clone` without support for argument juggling + * and `this` binding. * * @private * @param {*} value The value to clone. @@ -963,11 +1021,9 @@ * @returns {*} Returns the cloned value. */ function baseClone(value, isDeep, callback, stackA, stackB) { - if (callback) { - var result = callback(value); - if (typeof result != 'undefined') { - return result; - } + var result = callback ? callback(value) : undefined; + if (typeof result != 'undefined') { + return result; } var isObj = isObject(value); if (isObj) { @@ -1008,7 +1064,7 @@ result = isArr ? ctor(value.length) : {}; } else { - result = isArr ? slice(value) : assign({}, value); + result = isArr ? slice(value) : baseAssign({}, value); } // add array properties assigned by `RegExp#exec` if (isArr) { @@ -1030,7 +1086,10 @@ // recursively populate clone (susceptible to call stack limits) (isArr ? arrayEach : baseForOwn)(value, function(valValue, key) { - result[key] = baseClone(valValue, isDeep, callback, stackA, stackB); + var valClone = callback ? callback(valValue, key) : undefined; + result[key] = typeof valClone == 'undefined' + ? baseClone(valValue, isDeep, null, stackA, stackB) + : valClone; }); return result; @@ -1064,7 +1123,7 @@ /** * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. + * "_.pluck" and "_.where" style callbacks. * * @private * @param {*} [func=identity] The value to convert to a callback. @@ -1144,11 +1203,11 @@ key = func; function bound() { - var index = -1, - length = arguments.length, + var length = arguments.length, + index = length, args = Array(length); - while (++index < length) { + while (index--) { args[index] = arguments[index]; } if (partialArgs) { @@ -1234,7 +1293,7 @@ /** * The base implementation of `_.forEach` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -1260,7 +1319,7 @@ /** * The base implementation of `_.forEachRight` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -1284,8 +1343,8 @@ } /** - * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey` - * without support for callback shorthands or `this` binding which iterates + * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, + * without support for callback shorthands and `this` binding, which iterates * over `collection` using the provided `eachFunc`. * * @private @@ -1310,7 +1369,7 @@ /** * The base implementation of `_.flatten` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array} array The array to flatten. @@ -1399,7 +1458,7 @@ /** * The base implementation of `_.forIn` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -1412,7 +1471,7 @@ /** * The base implementation of `_.forOwn` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -1425,7 +1484,7 @@ /** * The base implementation of `_.forOwnRight` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -1462,7 +1521,7 @@ /** * The base implementation of `_.isEqual`, without support for `thisArg` - * binding, that allows partial "_.where" style comparisons. + * binding, which allows partial "_.where" style comparisons. * * @private * @param {*} value The value to compare to `other`. @@ -1474,11 +1533,9 @@ * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, callback, isWhere, stackA, stackB) { - if (callback) { - var result = callback(value, other); - if (typeof result != 'undefined') { - return !!result; - } + var result = callback && !stackA ? callback(value, other) : undefined; + if (typeof result != 'undefined') { + return !!result; } // exit early for identical values if (value === other) { @@ -1572,7 +1629,6 @@ return stackB[length] == other; } } - var size = 0; result = true; // add `value` and `other` to the stack of traversed objects @@ -1582,40 +1638,57 @@ // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary + var othLength = other.length; length = value.length; - size = other.length; - result = size == length; + result = othLength == length; if (result || isWhere) { + var othIndex = -1; + // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - othValue = other[size]; + while (++othIndex < othLength) { + var othValue = other[othIndex]; if (isWhere) { - while (index--) { - if ((result = baseIsEqual(value[index], othValue, callback, isWhere, stackA, stackB))) { + var index = -1; + while (++index < length) { + result = baseIsEqual(value[index], othValue, callback, isWhere, stackA, stackB); + if (result) { break; } } - if (!result) { - break; - } - } else if (!(result = baseIsEqual(value[size], othValue, callback, isWhere, stackA, stackB))) { + } else { + var valValue = value[othIndex]; + result = callback ? callback(valValue, othValue, othIndex) : undefined; + result = typeof result == 'undefined' + ? baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB) + : !!result; + } + if (!result) { break; } } } } else { + var size = 0; + // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly baseForIn(other, function(othValue, key, other) { if (hasOwnProperty.call(other, key)) { - // count the number of properties. + result = false; + // count the number of properties size++; - // deep compare each property value. - return (result = hasOwnProperty.call(value, key) && baseIsEqual(value[key], othValue, callback, isWhere, stackA, stackB)); + // deep compare each property value + if (hasOwnProperty.call(value, key)) { + var valValue = value[key]; + result = callback ? callback(valValue, othValue, key) : undefined; + result = typeof result == 'undefined' + ? baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB) + : !!result; + } + return result; } }); @@ -1624,7 +1697,8 @@ baseForIn(value, function(valValue, key, value) { if (hasOwnProperty.call(value, key)) { // `size` will be `-1` if `value` has more properties than `other` - return (result = --size > -1); + result = --size > -1; + return result; } }); } @@ -1636,8 +1710,32 @@ } /** - * The base implementation of `_.merge` without argument juggling or support - * for `this` binding. + * The base implementation of `_.invoke` which requires additional arguments + * be provided as an array of arguments rather than individually. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|string} methodName The name of the method to invoke or + * the function invoked per iteration. + * @param {Array} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + */ + function baseInvoke(collection, methodName, args) { + var index = -1, + isFunc = typeof methodName == 'function', + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); + + baseEach(collection, function(value) { + var func = isFunc ? methodName : (value != null && value[methodName]); + result[++index] = func ? func.apply(value, args) : undefined; + }); + return result; + } + + /** + * The base implementation of `_.merge` without support for argument juggling, + * multiple sources, and `this` binding. * * @private * @param {Object} object The destination object. @@ -1645,64 +1743,124 @@ * @param {Function} [callback] The function to customize merging properties. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {Object} Returns the destination object. */ function baseMerge(object, source, callback, stackA, stackB) { - (isArray(source) ? arrayEach : baseForOwn)(source, function(source, key) { - var found, - isArr, - result = source, + if (!object) { + return object; + } + (isArray(source) ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { + var isArr = srcValue && isArray(srcValue), + isObj = srcValue && isPlainObject(srcValue), value = object[key]; - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - var isShallow; - if (callback) { - result = callback(value, source); - if ((isShallow = typeof result != 'undefined')) { - value = result; - } - } - if (!isShallow) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!isShallow) { - baseMerge(value, source, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } + if (!(isArr || isObj)) { + result = callback ? callback(value, srcValue, key, object, source) : undefined; + if (typeof result == 'undefined') { + result = srcValue; } if (typeof result != 'undefined') { value = result; } + object[key] = value; + return; + } + // avoid merging previously merged cyclic sources + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == srcValue) { + object[key] = stackB[length]; + return; + } + } + var result = callback ? callback(value, srcValue, key, object, source) : undefined, + isShallow = typeof result != 'undefined'; + + if (isShallow) { + value = result; + } else { + value = isArr + ? (isArray(value) ? value : []) + : (isPlainObject(value) ? value : {}); + } + // add `source` and associated `value` to the stack of traversed objects + stackA.push(srcValue); + stackB.push(value); + + // recursively merge objects and arrays (susceptible to call stack limits) + if (!isShallow) { + baseMerge(value, srcValue, callback, stackA, stackB); } object[key] = value; }); + + return object; } /** - * The base implementation of `_.random` without argument juggling or support - * for returning floating-point numbers. + * The base implementation of `_.pick` without support for `this` binding + * and individual property name arguments. + * + * @private + * @param {Object} object The source object. + * @param {Function|string[]} predicate The function called per iteration or + * property names to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, predicate) { + var result = {}; + + if (typeof predicate == 'function') { + baseForIn(object, function(value, key, object) { + if (predicate(value, key, object)) { + result[key] = value; + } + }); + return result; + } + var index = -1, + props = predicate, + length = props.length; + + while (++index < length) { + var key = props[index]; + if (key in object) { + result[key] = object[key]; + } + } + return result; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * index arguments. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + */ + function basePullAt(array, indexes) { + var length = indexes.length, + result = baseAt(array, indexes); + + indexes.sort(baseCompareAscending); + while (length--) { + var index = parseFloat(indexes[length]); + if (index != previous && index > -1 && index % 1 == 0) { + var previous = index; + splice.call(array, index, 1); + } + } + return result; + } + + /** + * The base implementation of `_.random` without support for argument juggling + * and returning floating-point numbers. * * @private * @param {number} min The minimum possible value. @@ -1715,7 +1873,7 @@ /** * The base implementation of `_.uniq` without support for callback shorthands - * or `this` binding. + * and `this` binding. * * @private * @param {Array} array The array to process. @@ -1796,6 +1954,32 @@ return result; } + /** + * Compiles a function from `source` using the `varNames` and `varValues` + * pairs to import free variables into the compiled function. If `sourceURL` + * is provided it will be used as the sourceURL for the compiled function. + * + * @private + * @param {string} source The source to compile. + * @param {Array} varNames An array of free variable names. + * @param {Array} varValues An array of free variable values. + * @param {string} [sourceURL=''] The sourceURL of the source. + * @returns {Function} Returns the compiled function. + */ + function compileFunction(source, varNames, varValues, sourceURL) { + sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; + try { + // provide the compiled function's source by its `toString` method or + // the `source` property as a convenience for inlining compiled templates + var result = Function(varNames, 'return ' + source + sourceURL).apply(undefined, varValues); + result.source = source; + } catch(e) { + e.source = source; + throw e; + } + return result; + } + /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. @@ -1862,7 +2046,7 @@ * Creates a function that aggregates a collection, creating an accumulator * object composed from the results of running each element in the collection * through a callback. The given setter function sets the keys and values of - * the accumulator object. If `initializer` is provided will be used to + * the accumulator object. If `initializer` is provided it will be used to * initialize the accumulator object. * * @private @@ -1892,6 +2076,41 @@ }; } + /** + * Creates a function that assigns properties of source object(s) to a given + * destination object. + * + * @private + * @param {Function} assigner The function to customize assigning values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return function(object) { + var args = arguments, + length = args.length; + + if (!object || length < 2) { + return object; + } + // enables use as a callback for functions like `_.reduce` + var type = typeof args[2]; + if ((type == 'number' || type == 'string') && args[3] && args[3][args[2]] === args[1]) { + length = 2; + } + // juggle arguments + if (length > 3 && typeof args[length - 2] == 'function') { + var callback = baseCreateCallback(args[--length - 1], args[length--], 2); + } else if (length > 2 && typeof args[length - 1] == 'function') { + callback = args[--length]; + } + var index = 0; + while (++index < length) { + assigner(object, args[index], callback); + } + return object; + }; + } + /** * Creates a cache object to optimize linear searches of large arrays. * @@ -2090,6 +2309,7 @@ var setData = !defineProperty ? noop : function(func, value) { descriptor.value = value; defineProperty(func, expando, descriptor); + descriptor.value = null; }; /** @@ -2806,7 +3026,7 @@ * @memberOf _ * @category Arrays * @param {Array} array The array to modify. - * @param {...(number|number[])} [index] The indexes of values to remove, + * @param {...(number|number[])} [indexes] The indexes of elements to remove, * specified as individual indexes or arrays of indexes. * @returns {Array} Returns the new array of removed elements. * @example @@ -2821,19 +3041,7 @@ * // => [10, 20] */ function pullAt(array) { - var indexes = baseFlatten(arguments, true, false, 1), - length = indexes.length, - result = baseAt(array, indexes); - - indexes.sort(baseCompareAscending); - while (length--) { - var index = parseFloat(indexes[length]); - if (index != previous && index > -1 && index % 1 == 0) { - var previous = index; - splice.call(array, index, 1); - } - } - return result; + return basePullAt(array, baseFlatten(arguments, true, false, 1)); } /** @@ -2940,7 +3148,7 @@ var index = -1, length = array ? array.length : 0; - start = typeof start == 'undefined' ? 0 : (+start || 0); + start = start == null ? 0 : (+start || 0); if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { @@ -3520,8 +3728,8 @@ } /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * Checks if `value` is present in `collection` using strict equality for + * comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the * offset from the end of the collection. * * @static @@ -3650,8 +3858,10 @@ */ function every(collection, predicate, thisArg) { var result = true; - predicate = lodash.createCallback(predicate, thisArg, 3); + if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + predicate = lodash.createCallback(predicate, thisArg, 3); + } var index = -1, length = collection ? collection.length : 0; @@ -3663,7 +3873,8 @@ } } else { baseEach(collection, function(value, index, collection) { - return (result = !!predicate(value, index, collection)); + result = !!predicate(value, index, collection); + return result; }); } return result; @@ -3868,8 +4079,10 @@ */ function forEach(collection, callback, thisArg) { var length = collection ? collection.length : 0; - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof callback != 'function' || typeof thisArg != 'undefined') { + callback = baseCreateCallback(callback, thisArg, 3); + } return (typeof length == 'number' && length > -1 && length <= maxSafeInteger) ? arrayEach(collection, callback) : baseEach(collection, callback); @@ -3894,8 +4107,10 @@ */ function forEachRight(collection, callback, thisArg) { var length = collection ? collection.length : 0; - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof callback != 'function' || typeof thisArg != 'undefined') { + callback = baseCreateCallback(callback, thisArg, 3); + } return (typeof length == 'number' && length > -1 && length <= maxSafeInteger) ? arrayEachRight(collection, callback) : baseEachRight(collection, callback); @@ -3999,7 +4214,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|string} methodName The name of the method to invoke or * the function invoked per iteration. - * @param {...*} [args] Arguments to invoke the method with. + * @param {...*} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. * @example * @@ -4010,17 +4225,7 @@ * // => [['1', '2', '3'], ['4', '5', '6']] */ function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection && collection.length, - result = Array(length < 0 ? 0 : length >>> 0); - - baseEach(collection, function(value) { - var func = isFunc ? methodName : (value != null && value[methodName]); - result[++index] = func ? func.apply(value, args) : undefined; - }); - return result; + return baseInvoke(collection, methodName, slice(arguments, 2)); } /** @@ -4563,8 +4768,10 @@ */ function some(collection, predicate, thisArg) { var result; - predicate = lodash.createCallback(predicate, thisArg, 3); + if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + predicate = lodash.createCallback(predicate, thisArg, 3); + } var index = -1, length = collection ? collection.length : 0; @@ -4576,7 +4783,8 @@ } } else { baseEach(collection, function(value, index, collection) { - return !(result = predicate(value, index, collection)); + result = predicate(value, index, collection); + return !result; }); } return !!result; @@ -4765,7 +4973,7 @@ * @category Functions * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * @@ -4802,8 +5010,8 @@ * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodNames] The object method names to bind, specified - * as individual method names or arrays of method names. + * @param {...(string|string[])} [methodNames] The object method names to bind, + * specified as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * @@ -4817,12 +5025,26 @@ * // => logs 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; + return baseBindAll(object, arguments.length > 1 + ? baseFlatten(arguments, true, false, 1) + : functions(object)); + } + + /** + * The base implementation of `_.bindAll` without support for individual + * method name arguments. + * + * @private + * @param {Object} object The object to bind and assign the bound methods to. + * @param {string[]} methodNames The object method names to bind. + * @returns {Object} Returns `object`. + */ + function baseBindAll(object, methodNames) { + var index = -1, + length = methodNames.length; while (++index < length) { - var key = funcs[index]; + var key = methodNames[index]; object[key] = createWrapper(object[key], BIND_FLAG, null, object); } return object; @@ -4841,7 +5063,7 @@ * @category Functions * @param {Object} object The object the method belongs to. * @param {string} key The key of the method. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * @@ -5105,7 +5327,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to defer. - * @param {...*} [args] Arguments to invoke the function with. + * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * @@ -5129,7 +5351,7 @@ * @category Functions * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [args] Arguments to invoke the function with. + * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * @@ -5274,7 +5496,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * @@ -5304,7 +5526,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * @@ -5410,8 +5632,8 @@ * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). + * assigned values. The callback is bound to `thisArg` and invoked with + * five arguments; (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ @@ -5434,45 +5656,14 @@ * defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' }); * // => { 'name': 'barney', 'employer': 'slate' } */ - function assign(object, source, guard) { - var args = arguments; - if (!object || args.length < 2) { - return object; - } - var argsIndex = 0, - argsLength = args.length, - type = typeof guard; - - // enables use as a callback for functions like `_.reduce` - if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { - argsLength = 2; - } - // juggle arguments - if (argsLength > 3 && typeof args[argsLength - 2] == 'function') { - var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2); - } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') { - callback = args[--argsLength]; - } - while (++argsIndex < argsLength) { - source = args[argsIndex]; - var index = -1, - props = keys(source), - length = props.length; - - while (++index < length) { - var key = props[index]; - object[key] = callback ? callback(object[key], source[key]) : source[key]; - } - } - return object; - } + var assign = createAssigner(baseAssign); /** * Creates a clone of `value`. If `isDeep` is `true` nested objects will also * be cloned, otherwise they will be assigned by reference. If a callback * is provided it will be executed to produce the cloned values. If the * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). + * The callback is bound to `thisArg` and invoked with two argument; (value, index|key). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -5535,7 +5726,7 @@ * Creates a deep clone of `value`. If a callback is provided it will be * executed to produce the cloned values. If the callback returns `undefined` * cloning will be handled by the method instead. The callback is bound to - * `thisArg` and invoked with one argument; (value). + * `thisArg` and invoked with two argument; (value, index|key). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -5611,7 +5802,7 @@ */ function create(prototype, properties) { var result = baseCreate(prototype); - return properties ? assign(result, properties) : result; + return properties ? baseAssign(result, properties) : result; } /** @@ -5763,7 +5954,9 @@ * // => logs 'x', 'y', and 'z' (property order is not guaranteed across environments) */ function forIn(object, callback, thisArg) { - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof callback != 'function' || typeof thisArg != 'undefined') { + callback = baseCreateCallback(callback, thisArg, 3); + } return baseFor(object, callback, keysIn); } @@ -5818,7 +6011,9 @@ * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) */ function forOwn(object, callback, thisArg) { - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof callback != 'function' || typeof thisArg != 'undefined') { + callback = baseCreateCallback(callback, thisArg, 3); + } return baseForOwn(object, callback); } @@ -6082,7 +6277,8 @@ return !length; } baseForOwn(value, function() { - return (result = false); + result = false; + return result; }); return result; } @@ -6092,7 +6288,7 @@ * equivalent. If a callback is provided it will be executed to compare * values. If the callback returns `undefined` comparisons will be handled * by the method instead. The callback is bound to `thisArg` and invoked - * with two arguments; (value, other). + * with three arguments; (value, other, key). * * Note: This method supports comparing arrays, booleans, `Date` objects, * numbers, `Object` objects, regexes, and strings. Functions and DOM nodes @@ -6218,13 +6414,17 @@ * // => false */ function isFunction(value) { - return typeof value == 'function'; + // avoid a Chakra bug in IE 11 + // https://github.com/jashkenas/underscore/issues/1621 + return typeof value == 'function' || false; } /** * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * + * Note: See the [ES5 spec](http://es5.github.io/#x8) for more details. + * * @static * @memberOf _ * @category Objects @@ -6242,9 +6442,7 @@ * // => false */ function isObject(value) { - // check if the value is the ECMAScript language type of `Object` - // http://es5.github.io/#x8 - // and avoid a V8 bug + // avoid a V8 bug in Chrome 19-20 // https://code.google.com/p/v8/issues/detail?id=2291 var type = typeof value; return type == 'function' || (value && type == 'object') || false; @@ -6566,7 +6764,7 @@ * provided it will be executed to produce the merged values of the destination * and source properties. If the callback returns `undefined` merging will * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). + * invoked with five arguments; (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ @@ -6610,34 +6808,7 @@ * }); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } */ - function merge(object, source, guard) { - var args = arguments, - length = args.length, - type = typeof guard; - - if (!object || length < 2) { - return object; - } - // enables use as a callback for functions like `_.reduce` - if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { - length = 2; - } - // juggle arguments - if (length > 3 && typeof args[length - 2] == 'function') { - var callback = baseCreateCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - var sources = slice(args, 1, length), - index = -1, - stackA = [], - stackB = []; - - while (++index < length) { - baseMerge(object, sources[index], callback, stackA, stackB); - } - return object; - } + var merge = createAssigner(baseMerge); /** * Creates a shallow clone of `object` excluding the specified properties. @@ -6667,9 +6838,11 @@ * // => { 'name': 'fred' } */ function omit(object, predicate, thisArg) { + if (!isObject(object)) { + return {}; + } if (typeof predicate == 'function') { - predicate = lodash.createCallback(predicate, thisArg, 3); - return pick(object, negate(predicate)); + return basePick(object, negate(lodash.createCallback(predicate, thisArg, 3))); } var omitProps = baseFlatten(arguments, true, false, 1), length = omitProps.length; @@ -6677,7 +6850,7 @@ while (length--) { omitProps[length] = String(omitProps[length]); } - return pick(object, baseDifference(keysIn(object), omitProps)); + return basePick(object, baseDifference(keysIn(object), omitProps)); } /** @@ -6735,28 +6908,12 @@ * // => { 'name': 'fred' } */ function pick(object, predicate, thisArg) { - var result = {}; - - if (typeof predicate != 'function') { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - predicate = lodash.createCallback(predicate, thisArg, 3); - baseForIn(object, function(value, key, object) { - if (predicate(value, key, object)) { - result[key] = value; - } - }); + if (!isObject(object)) { + return {}; } - return result; + return basePick(object, typeof predicate == 'function' + ? lodash.createCallback(predicate, thisArg, 3) + : baseFlatten(arguments, true, false, 1)); } /** @@ -7204,7 +7361,7 @@ * settings object is provided it will override `_.templateSettings` for the * template. * - * Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging. + * Note: In the development build, `_.template` utilizes sourceURLs for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * @@ -7222,9 +7379,9 @@ * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The HTML "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. + * @param {Object} [options.imports] An object to import into the template as free variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source. + * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @returns {Function|string} Returns the interpolated string if a data object * is provided, else the compiled template function. @@ -7262,7 +7419,7 @@ * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); * // => '
  • fred
  • barney
  • ' * - * // using the `sourceURL` option to specify a custom `sourceURL` for the template + * // using the `sourceURL` option to specify a custom sourceURL for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector @@ -7290,10 +7447,10 @@ // and Laura Doktorova's doT.js // https://github.com/olado/doT var settings = lodash.templateSettings; - options = defaults({}, options, settings); + options = assign({}, options, settings, assignOwnDefaults); string = String(string == null ? '' : string); - var imports = defaults({}, options.imports, settings.imports), + var imports = assign({}, options.imports, settings.imports, assignOwnDefaults), importsKeys = keys(imports), importsValues = values(imports); @@ -7368,24 +7525,12 @@ source + 'return __p\n}'; - // Use a `sourceURL` for easier debugging. + // use a sourceURL for easier debugging // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; + var sourceURL = options.sourceURL || ('/lodash/template/source[' + (templateCounter++) + ']'), + result = compileFunction(source, importsKeys, importsValues, sourceURL); - try { - var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues); - } catch(e) { - e.source = source; - throw e; - } - if (data) { - return result(data); - } - // provide the compiled function's source by its `toString` method, in - // supported environments, or the `source` property as a convenience for - // inlining compiled templates during the build process - result.source = source; - return result; + return data ? result(data) : result; } /** @@ -7636,10 +7781,14 @@ * // => [{ 'name': 'fred', 'age': 40 }] */ function createCallback(func, thisArg, argCount) { - var type = typeof func; - if (type == 'function' || func == null) { - return (typeof thisArg == 'undefined' || !(func && 'prototype' in func)) && - func || baseCreateCallback(func, thisArg, argCount); + var type = typeof func, + isFunc = type == 'function'; + + if (isFunc && (typeof thisArg == 'undefined' || !('prototype' in func))) { + return func; + } + if (isFunc || func == null) { + return baseCreateCallback(func, thisArg, argCount); } // handle "_.pluck" and "_.where" style callback shorthands return type == 'object' ? matches(func) : property(func); @@ -7711,15 +7860,14 @@ if (length && !object) { return false; } - var result = true; while (length--) { var key = props[length]; - if (!(result = hasOwnProperty.call(object, key) && - baseIsEqual(object[key], source[key], null, true))) { - break; + if (!(hasOwnProperty.call(object, key) && + baseIsEqual(object[key], source[key], null, true))) { + return false; } } - return result; + return true; }; } @@ -8082,7 +8230,7 @@ * @returns {Array} Returns the array of results. * @example * - * var diceRolls = _.times(3, _.partial(_.random, 1, 6)); + * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false)); * // => [3, 6, 4] * * _.times(3, function(n) { mage.castSpell(n); }); @@ -8225,7 +8373,7 @@ lodash.unzip = zip; // add functions to `lodash.prototype` - mixin(lodash, assign({}, lodash)); + mixin(lodash, baseAssign({}, lodash)); /*--------------------------------------------------------------------------*/ @@ -8305,7 +8453,7 @@ lodash.inject = reduce; mixin(lodash, (function() { - var source = {} + var source = {}; baseForOwn(lodash, function(func, methodName) { if (!lodash.prototype[methodName]) { source[methodName] = func; @@ -8329,9 +8477,9 @@ lodash.head = first; baseForOwn(lodash, function(func, methodName) { - var callbackable = methodName !== 'sample'; + var callbackable = methodName != 'sample'; if (!lodash.prototype[methodName]) { - lodash.prototype[methodName]= function(n, guard) { + lodash.prototype[methodName] = function(n, guard) { var chainAll = this.__chain__, result = func(this.__wrapped__, n, guard); @@ -8362,7 +8510,7 @@ // add `Array` functions that return unwrapped values arrayEach(['join', 'pop', 'shift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { var chainAll = this.__chain__, result = func.apply(this.__wrapped__, arguments); @@ -8375,7 +8523,7 @@ // add `Array` functions that return the existing wrapped value arrayEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -8384,7 +8532,7 @@ // add `Array` functions that return new wrapped values arrayEach(['concat', 'splice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__); }; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index f77af7c97..e2ba8d833 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,64 +3,65 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Lr(e);++ri(t,f)&&l.push(f);return l}function bt(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number"&&-1a(p,h)&&((r||l)&&p.push(h),c.push(s))}return c}function Tt(n,t){for(var r=-1,e=t(n),u=e.length,o=Lr(u);++ro?0:o)}function Kt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?je(u+r,0):r||0;else if(r)return r=Yt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Mt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++ -}else o=null==t||r?1:t;return o=e-(o||0),Xt(n,0,0>o?0:o)}function Vt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:d;return o=e-(o||0),Xt(n,0>o?0:o)}function Jt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Xt(n,o)}function Xt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=je(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=je(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Lr(u);++e>>1,r(n[e])r?0:r);++tr?je(e+r,0):r||0:0,typeof n=="string"||!We(n)&&Ar(n)?ru&&(u=a)}else t=null==t&&Ar(n)?o:U.createCallback(t,r,3),bt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n)});return u}function lr(n,t){return ar(n,Dr(t))}function cr(n,t,r,e){var u=3>arguments.length;t=U.createCallback(t,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return t=U.createCallback(t,e,4),_t(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o) -}),r}function sr(n){var t=-1,r=n&&n.length,e=Lr(0>r?0:r>>>0);return bt(n,function(n){var r=Nt(0,++t);e[t]=e[r],e[r]=n}),e}function hr(n,t,r){var e;t=U.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return zt(n,b,null,t);if(n)var r=n[A]?n[A][2]:n.length,e=Xt(arguments,2),r=r-e.length;return zt(n,b|k,r,t,e)}function vr(n,t,r){var e,u,o,i,a,f,l,c=0,p=false,s=true; -if(!jr(n))throw new Jr(O);if(t=0>t?0:t,true===r)var h=true,s=false;else kr(r)&&(h=r.leading,p="maxWait"in r&&je(t,+r.maxWait||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(qe()-i);0>=r||r>t?(u&&ue(u),r=l,u=f=l=d,r&&(c=qe(),o=n.apply(a,e),f||u||(e=a=null))):f=se(g,r)},v=function(){f&&ue(f),u=f=l=d,(s||p!==t)&&(c=qe(),o=n.apply(a,e),f||u||(e=a=null))};return function(){if(e=arguments,i=qe(),a=this,l=s&&(f||!h),false===p)var r=h&&!f;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=ue(u)),c=i,o=n.apply(a,e)):u||(u=se(v,y)) -}return m&&f?f=ue(f):f||t===p||(f=se(g,t)),r&&(m=true,o=n.apply(a,e)),!m||f||u||(e=a=null),o}}function yr(n){if(!jr(n))throw new Jr(O);return function(){return!n.apply(this,arguments)}}function mr(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=Lr(r),a=0t||null==n||!be(t))return r;n=Vr(n);do t%2&&(r+=n),t=oe(t/2),n+=n;while(t);return r}function Sr(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(g(n),v(n)+1):(t=Vr(t),n.slice(i(n,t),a(n,t)+1)):n}function Tr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||vt(n,t,r):"object"==e?Wr(n):Dr(n) -}function Fr(n){return n}function Wr(n){var t=ze(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||kr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=fe.call(e,o)&&It(e[o],n[o],null,true)););return o}:function(n){return n&&fe.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function $r(n,t,r){var e=true,u=t&&Et(t,ze);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Et(t,ze)),false===r?e=false:kr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=jr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0 -}},U.assign=mr,U.at=function(n){return t(n,jt(arguments,true,false,1))},U.bind=gr,U.bindAll=function(n){for(var t=1arguments.length?zt(t,b|_,null,n):zt(t,b|_|k,null,n,Xt(arguments,2))},U.chain=function(n){return new V(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(s?u(s,f):i(p,f))){for(t=r;--t;){var h=o[t]; -if(0>(h?u(h,f):i(n[t],f)))continue n}s&&s.push(f),p.push(f)}return p},U.invert=function(n,t){for(var r=-1,e=ze(n),u=e.length,o={};++ro?0:o>>>0);return bt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):d}),i},U.keys=ze,U.keysIn=Or,U.map=ar,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u) -}),e},U.matches=Wr,U.max=fr,U.memoize=function(n,t){if(!jr(n)||t&&!jr(t))throw new Jr(O);var r=function(){var e=t?t.apply(this,arguments):arguments[0];if("__proto__"==e)return n.apply(this,arguments);var u=r.cache;return fe.call(u,e)?u[e]:u[e]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(o||(t=U.createCallback(t,r,3)),bt(n,function(n,r,u){if(o)for(r=t.length,u=Lr(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?l:f);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!jr(n))throw new Jr(O);return false===r?e=false:kr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),at.leading=e,at.maxWait=+t,at.trailing=u,vr(n,t,at) -},U.times=function(n,t,r){n=0>n?0:n>>>0,t=vt(t,r,1),r=-1;for(var e=Lr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Vr(n).replace(F,s)},U.escapeRegExp=Rr,U.every=rr,U.find=ur,U.findIndex=Zt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,At,true) -},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,_t)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,Ot,true)},U.findWhere=function(n,t){return ur(n,Wr(t))},U.has=function(n,t){return n?fe.call(n,t):false},U.identity=Fr,U.indexOf=Kt,U.isArguments=_r,U.isArray=We,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&te.call(n)==H||false -},U.isDate=function(n){return n&&typeof n=="object"&&te.call(n)==Q||false},U.isElement=wr,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?je(e+r,0):ke(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return p._=Qr,this},U.noop=zr,U.now=qe,U.pad=function(n,t,r){n=null==n?"":Vr(n),t=+t; -var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=dr({},r,e),n=Vr(null==n?"":n);var u,o,i=dr({},r.imports,e.imports),e=ze(i),i=Ir(i),a=0,f=r.interpolate||Z,l="__p+='",f=Mr((r.escape||Z).source+"|"+f.source+"|"+(f===z?D:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); -n.replace(f,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(M,h),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(r=r.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(R,""):l).replace(N,"$1").replace(S,"$1;"),l="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=Ur(e,"return "+l).apply(d,i) -}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},U.trim=Sr,U.trimLeft=function(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(g(n)):(t=Vr(t),n.slice(i(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(0,v(n)+1):(t=Vr(t),n.slice(0,a(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&kr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Vr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Vr(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(Cr(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Mr(u.source,(L.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(T,y))},U.uniqueId=function(n){var t=++E;return Vr(null==n?"":n)+t},U.all=rr,U.any=hr,U.detect=ur,U.foldl=cr,U.foldr=pr,U.include=tr,U.inject=cr,$r(U,function(){var n={}; -return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Pt,U.last=Vt,U.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=Ir(n)),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Pt,U.takeRight=Vt,U.takeRightWhile=Vt,U.takeWhile=Pt,U.head=Pt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.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 V(o,u):o -})}),U.VERSION=C,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=nr,U.prototype.toString=function(){return Vr(this.__wrapped__)},U.prototype.value=nr,U.prototype.valueOf=nr,lt(["join","pop","shift"],function(n){var t=Xr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),lt(["push","reverse","sort","unshift"],function(n){var t=Xr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} -}),lt(["concat","splice"],function(n){var t=Xr[n];U.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments),this.__chain__)}}),U}var d,b=1,_=2,w=4,j=8,k=16,x=32,C="2.4.1",A="__lodash@"+C+"__",O="Expected a function",E=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,S=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,W=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,L=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,P=/[.*+?^${}()|[\]\/\\]/g,K=/\bthis\b/,M=/['\n\r\u2028\u2029\\]/g,V=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,J=" \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",X="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="[object Arguments]",G="[object Array]",H="[object Boolean]",Q="[object Date]",nt="[object Error]",tt="[object Function]",rt="[object Number]",et="[object Object]",ut="[object RegExp]",ot="[object String]",it={}; -it[tt]=false,it[Y]=it[G]=it[H]=it[Q]=it[rt]=it[et]=it[ut]=it[ot]=true;var at={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},lt={"&":"&","<":"<",">":">",'"':""","'":"'"},ct={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},st={"function":true,object:true},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},gt=st[typeof window]&&window||this,vt=st[typeof exports]&&exports&&!exports.nodeType&&exports,st=st[typeof module]&&module&&!module.nodeType&&module,yt=vt&&st&&typeof global=="object"&&global; -!yt||yt.global!==yt&&yt.window!==yt&&yt.self!==yt||(gt=yt);var yt=st&&st.exports===vt&&vt,mt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gt._=mt, define(function(){return mt})):vt&&st?yt?(st.exports=mt)._=mt:vt._=mt:gt._=mt}).call(this); \ No newline at end of file +;(function(){function n(n,t){for(var e=-1,r=t.length,u=Array(r);++et||typeof n=="undefined")return 1;if(nr||13r||8202e||13e||8202>>0:0,u=qe(r);++ei(t,f)&&l.push(f);return l}function wt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number"&&-1o?0:o>>>0);return wt(n,function(n){var o=u?t:null!=n&&n[t];i[++r]=o?o.apply(n,e):m}),i}function Tt(n,t,e,r,u){return n?((zr(t)?ft:Et)(t,function(t,o,i){var a=t&&zr(t),f=t&&Br(t),l=n[o];if(a||f){for(r||(r=[]),u||(u=[]),f=r.length;f--;)if(r[f]==t)return void(n[o]=u[f]);i=e?e(l,t,o,n,i):m,l=(f=typeof i!="undefined")?i:a?zr(l)?l:[]:Br(l)?l:{},r.push(t),u.push(l),f||Tt(l,t,e,r,u)}else i=e?e(l,t,o,n,i):m,typeof i=="undefined"&&(i=t),typeof i!="undefined"&&(l=i); +n[o]=l}),n):n}function Ft(n,t){var e={};if(typeof t=="function")return Ot(n,function(n,r,u){t(n,r,u)&&(e[r]=n)}),e;for(var r=-1,u=t.length;++ra(p,h)&&((u||l)&&p.push(h),c.push(s)) +}return c}function Lt(n,t){for(var e=-1,r=t(n),u=r.length,o=qe(u);++er)return t;var u=typeof e[2];if("number"!=u&&"string"!=u||!e[3]||e[3][e[2]]!==e[1]||(r=2),3o?0:o)}function Gt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?Cr(u+r,0):r||0;else if(r)return r=ee(n,t),u&&n[r]===t?r:-1;return e(n,t,r) +}function Ht(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,o=0;for(t=U.createCallback(t,e,3);u--&&t(n[u],u,n);)o++}else o=null==t||e?1:t;return o=r-(o||0),te(n,0,0>o?0:o)}function Qt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,o=0;for(t=U.createCallback(t,e,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||e)return n?n[r-1]:m;return o=r-(o||0),te(n,0>o?0:o)}function ne(n,t,e){if(typeof t!="number"&&null!=t){var r=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,e,3);++rt?0:t;return te(n,o)}function te(n,t,e){var r=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=Cr(u+t,0):t>u&&(t=u),e=typeof e=="undefined"?u:+e||0,0>e?e=Cr(u+e,0):e>u&&(e=u),u=t>e?0:e-t,e=qe(u);++r>>1,e(n[r])e?0:e);++te?Cr(r+e,0):e||0:0,typeof n=="string"||!zr(n)&&Re(n)?eo&&(o=a)}else t=null==t&&Re(n)?u:U.createCallback(t,e,3),wt(n,function(n,e,u){e=t(n,e,u),(e>r||-1/0===e&&e===o)&&(r=e,o=n)});return o}function ve(n,t){return he(n,Ue(t))}function ye(n,t,e,r){var u=3>arguments.length;t=U.createCallback(t,r,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return t=U.createCallback(t,r,4),jt(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function de(n){var t=-1,e=n&&n.length,r=qe(0>e?0:e>>>0);return wt(n,function(n){var e=Wt(0,++t);r[t]=r[e],r[e]=n}),r}function be(n,t,e){var r;(typeof t!="function"||typeof e!="undefined")&&(t=U.createCallback(t,e,3)),e=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return Zt(n,d,null,t);if(n)var e=n[C]?n[C][2]:n.length,r=te(arguments,2),e=e-r.length;return Zt(n,d|j,e,t,r)}function we(n,t,e){var r,u,o,i,a,f,l,c=0,p=false,s=true;if(!Ae(n))throw new Ge(A);if(t=0>t?0:t,true===e)var h=true,s=false;else Oe(e)&&(h=e.leading,p="maxWait"in e&&Cr(t,+e.maxWait||0),s="trailing"in e?e.trailing:s);var g=function(){var e=t-(Mr()-i);0>=e||e>t?(u&&ar(u),e=l,u=f=l=m,e&&(c=Mr(),o=n.apply(a,r),f||u||(r=a=null))):f=vr(g,e) +},v=function(){f&&ar(f),u=f=l=m,(s||p!==t)&&(c=Mr(),o=n.apply(a,r),f||u||(r=a=null))};return function(){if(r=arguments,i=Mr(),a=this,l=s&&(f||!h),false===p)var e=h&&!f;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=ar(u)),c=i,o=n.apply(a,r)):u||(u=vr(v,y))}return m&&f?f=ar(f):f||t===p||(f=vr(g,t)),e&&(m=true,o=n.apply(a,r)),!m||f||u||(r=a=null),o}}function je(n){if(!Ae(n))throw new Ge(A);return function(){return!n.apply(this,arguments)}}function xe(n){return Rt(n,Ne)}function ke(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ur.call(n)==X||false +}function Ce(n){return n&&typeof n=="object"&&1===n.nodeType&&-1>>0,r=n.constructor,u=-1,r=r&&n===r.prototype,o=e-1,i=qe(e),a=0t||null==n||!jr(t))return e;n=Ye(n);do t%2&&(e+=n),t=fr(t/2),n+=n;while(t);return e}function We(n,t){return(n=null==n?"":Ye(n))?null==t?n.slice(h(n),g(n)+1):(t=Ye(t),n.slice(o(n,t),i(n,t)+1)):n}function $e(n,t,e){var r=typeof n,u="function"==r;return!u||typeof t!="undefined"&&"prototype"in n?u||null==n?dt(n,t,e):"object"==r?De(n):Ue(n):n +}function Le(n){return n}function De(n){var t=Ur(n),e=t.length,r=t[0],u=e&&n[r];return 1!=e||u!==u||Oe(u)?function(r){var u=e;if(u&&!r)return false;for(;u--;){var o=t[u];if(!pr.call(r,o)||!Nt(r[o],n[o],null,true))return false}return true}:function(n){return n&&pr.call(n,r)?(n=n[r],u===n&&(0!==u||1/u==1/n)):false}}function ze(n,t,e){var r=true,u=t&&Rt(t,Ur);t&&(e||u.length)||(null==e&&(e=t),t=n,n=this,u=Rt(t,Ur)),false===e?r=false:Oe(e)&&"chain"in e&&(r=e.chain),e=-1;for(var o=Ae(n),i=u?u.length:0;++e--n?t.apply(this,arguments):void 0}},U.assign=Dr,U.at=function(t){return n(t,kt(arguments,true,false,1))},U.bind=_e,U.bindAll=function(n){for(var t=n,e=1arguments.length?Zt(t,d|b,null,n):Zt(t,d|b|j,null,n,te(arguments,2))},U.chain=function(n){return new M(n,true)},U.compact=function(n){for(var t=-1,e=n?n.length:0,r=0,u=[];++t(s?r(s,f):i(p,f))){for(t=u;--t;){var h=o[t];if(0>(h?r(h,f):i(n[t],f)))continue n}s&&s.push(f),p.push(f)}return p},U.invert=function(n,t){for(var e=-1,r=Ur(n),u=r.length,o={};++eu?0:u>>>0);for(o||(t=U.createCallback(t,e,3)),wt(n,function(n,e,u){if(o)for(e=t.length,u=qe(e);e--;)u[e]=n[t[e]];else u=t(n,e,u);i[++r]={a:u,b:r,c:n}}),u=i.length,i.sort(o?f:a);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,e){return t.call(e,n),n},U.throttle=function(n,t,e){var r=true,u=true;if(!Ae(n))throw new Ge(A);return false===e?r=false:Oe(e)&&(r="leading"in e?!!e.leading:r,u="trailing"in e?!!e.trailing:u),it.leading=r,it.maxWait=+t,it.trailing=u,we(n,t,it) +},U.times=function(n,t,e){n=0>n?0:n>>>0,t=dt(t,e,1),e=-1;for(var r=qe(n);++ee?0:+e||0,r))-t.length,0<=e&&n.indexOf(t,e)==e},U.escape=function(n){return null==n?"":Ye(n).replace(T,p)},U.escapeRegExp=Te,U.every=fe,U.find=ce,U.findIndex=Xt,U.findKey=function(n,t,e){return t=U.createCallback(t,e,3),xt(n,t,Et,true) +},U.findLast=function(n,t,e){return t=U.createCallback(t,e,3),xt(n,t,jt)},U.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=U.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},U.findLastKey=function(n,t,e){return t=U.createCallback(t,e,3),xt(n,t,It,true)},U.findWhere=function(n,t){return ce(n,De(t))},U.has=function(n,t){return n?pr.call(n,t):false},U.identity=Le,U.indexOf=Gt,U.isArguments=ke,U.isArray=zr,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ur.call(n)==G||false +},U.isDate=function(n){return n&&typeof n=="object"&&ur.call(n)==H||false},U.isElement=Ce,U.isEmpty=function(n){var t=true;if(!n)return t;var e=n.length;return-1e?Cr(r+e,0):Ar(e||0,r-1))+1);r--;)if(n[r]===t)return r;return-1},U.noConflict=function(){return c._=er,this},U.noop=Be,U.now=Mr,U.pad=function(n,t,e){n=null==n?"":Ye(n),t=+t; +var r=n.length;return re?0:+e||0,n.length),n.lastIndexOf(t,e)==e},U.template=function(n,t,e){var r=U.templateSettings;e=Dr({},e,r,pt),n=Ye(null==n?"":n);var u,o,i=Dr({},e.imports,r.imports,pt),r=Ur(i),i=Se(i),a=0,f=e.interpolate||q,l="__p+='",f=Xe((e.escape||q).source+"|"+f.source+"|"+(f===$?L:q).source+"|"+(e.evaluate||q).source+"|$","g"); +return n.replace(f,function(t,e,r,i,f,c){return r||(r=i),l+=n.slice(a,c).replace(K,s),e&&(u=true,l+="'+__e("+e+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(e=e.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(I,""):l).replace(R,"$1").replace(N,"$1;"),l="function("+(e||"obj")+"){"+(e?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",e=Dt(l,r,i,void 0),t?e(t):e +},U.trim=We,U.trimLeft=function(n,t){return(n=null==n?"":Ye(n))?null==t?n.slice(h(n)):(t=Ye(t),n.slice(o(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Ye(n))?null==t?n.slice(0,g(n)+1):(t=Ye(t),n.slice(0,i(n,t)+1)):n},U.truncate=function(n,t){var e=30,r="...";if(t&&Oe(t))var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e,r="omission"in t?Ye(t.omission):r;else null!=t&&(e=+t||0);if(n=null==n?"":Ye(n),e>=n.length)return n;var o=e-r.length;if(1>o)return r;if(e=n.slice(0,o),null==u)return e+r; +if(Ie(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Xe(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;e=e.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=e.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(S,v))},U.uniqueId=function(n){var t=++O;return Ye(null==n?"":n)+t},U.all=fe,U.any=be,U.detect=ce,U.foldl=ye,U.foldr=me,U.include=ae,U.inject=ye,ze(U,function(){var n={};return Et(U,function(t,e){U.prototype[e]||(n[e]=t) +}),n}(),false),U.first=Yt,U.last=Qt,U.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=Se(n)),null==t||e?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Yt,U.takeRight=Qt,U.takeRightWhile=Qt,U.takeWhile=Yt,U.head=Yt,Et(U,function(n,t){var e="sample"!=t;U.prototype[t]||(U.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new M(o,u):o})}),U.VERSION=k,U.prototype.chain=function(){return this.__chain__=true,this +},U.prototype.toJSON=ie,U.prototype.toString=function(){return Ye(this.__wrapped__)},U.prototype.value=ie,U.prototype.valueOf=ie,ft(["join","pop","shift"],function(n){var t=He[n];U.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new M(e,n):e}}),ft(["push","reverse","sort","unshift"],function(n){var t=He[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ft(["concat","splice"],function(n){var t=He[n];U.prototype[n]=function(){return new M(t.apply(this.__wrapped__,arguments),this.__chain__) +}}),U}var m,d=1,b=2,_=4,w=8,j=16,x=32,k="2.4.1",C="__lodash@"+k+"__",A="Expected a function",O=0,E=/^[A-Z]+$/,I=/\b__p\+='';/g,R=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,S=/&(?:amp|lt|gt|quot|#39);/g,T=/[&<>"']/g,F=/<%-([\s\S]+?)%>/g,W=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,L=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,B=/^0[xX]/,U=/[\xC0-\xFF]/g,q=/($^)/,Z=/[.*+?^${}()|[\]\/\\]/g,P=/\bthis\b/,K=/['\n\r\u2028\u2029\\]/g,M=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,V=" \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",J="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),X="[object Arguments]",Y="[object Array]",G="[object Boolean]",H="[object Date]",Q="[object Error]",nt="[object Function]",tt="[object Number]",et="[object Object]",rt="[object RegExp]",ut="[object String]",ot={}; +ot[nt]=false,ot[X]=ot[Y]=ot[G]=ot[H]=ot[tt]=ot[et]=ot[rt]=ot[ut]=true;var it={leading:false,maxWait:0,trailing:false},at={configurable:false,enumerable:false,value:null,writable:false},ft={"&":"&","<":"<",">":">",'"':""","'":"'"},lt={"&":"&","<":"<",">":">",""":'"',"'":"'"},ct={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},pt={"function":true,object:true},st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ht=pt[typeof window]&&window||this,gt=pt[typeof exports]&&exports&&!exports.nodeType&&exports,pt=pt[typeof module]&&module&&!module.nodeType&&module,vt=gt&&pt&&typeof global=="object"&&global; +!vt||vt.global!==vt&&vt.window!==vt&&vt.self!==vt||(ht=vt);var vt=pt&&pt.exports===gt&>,yt=y();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ht._=yt, define(function(){return yt})):gt&&pt?vt?(pt.exports=yt)._=yt:gt._=yt:ht._=yt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 4bda279f3..bdc0aa335 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -222,7 +222,7 @@ /*--------------------------------------------------------------------------*/ /** Used for native method references */ - var arrayRef = Array.prototype, + var arrayProto = Array.prototype, objectProto = Object.prototype; /** Used to restore the original `_` reference in `_.noConflict` */ @@ -249,9 +249,9 @@ floor = Math.floor, fnToString = Function.prototype.toString, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayRef.push, + push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayRef.splice; + splice = arrayProto.splice; /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, @@ -470,6 +470,31 @@ return result; } + /** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `this` binding. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} [callback] The function to customize assigning values. + * @returns {Object} Returns the destination object. + */ + function baseAssign(object, source, callback) { + if (!object) { + return object; + } + var index = -1, + props = keys(source), + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = callback ? callback(object[key], source[key], key, object, source) : source[key]; + } + return object; + } + /** * The base implementation of `_.create` without support for assigning * properties to the created object. @@ -498,7 +523,7 @@ /** * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. + * "_.pluck" and "_.where" style callbacks. * * @private * @param {*} [func=identity] The value to convert to a callback. @@ -555,11 +580,11 @@ key = func; function bound() { - var index = -1, - length = arguments.length, + var length = arguments.length, + index = length, args = Array(length); - while (++index < length) { + while (index--) { args[index] = arguments[index]; } if (partialArgs) { @@ -605,7 +630,7 @@ /** * The base implementation of `_.forEach` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -631,7 +656,7 @@ /** * The base implementation of `_.forEachRight` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -655,8 +680,8 @@ } /** - * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey` - * without support for callback shorthands or `this` binding which iterates + * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, + * without support for callback shorthands and `this` binding, which iterates * over `collection` using the provided `eachFunc`. * * @private @@ -681,7 +706,7 @@ /** * The base implementation of `_.flatten` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Array} array The array to flatten. @@ -770,7 +795,7 @@ /** * The base implementation of `_.forIn` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -783,7 +808,7 @@ /** * The base implementation of `_.forOwn` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -796,7 +821,7 @@ /** * The base implementation of `_.forOwnRight` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. @@ -833,7 +858,7 @@ /** * The base implementation of `_.isEqual`, without support for `thisArg` - * binding, that allows partial "_.where" style comparisons. + * binding, which allows partial "_.where" style comparisons. * * @private * @param {*} value The value to compare to `other`. @@ -956,8 +981,66 @@ } /** - * The base implementation of `_.random` without argument juggling or support - * for returning floating-point numbers. + * The base implementation of `_.invoke` which requires additional arguments + * be provided as an array of arguments rather than individually. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|string} methodName The name of the method to invoke or + * the function invoked per iteration. + * @param {Array} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + */ + function baseInvoke(collection, methodName, args) { + var index = -1, + isFunc = typeof methodName == 'function', + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); + + baseEach(collection, function(value) { + var func = isFunc ? methodName : (value != null && value[methodName]); + result[++index] = func ? func.apply(value, args) : undefined; + }); + return result; + } + + /** + * The base implementation of `_.pick` without support for `this` binding + * and individual property name arguments. + * + * @private + * @param {Object} object The source object. + * @param {Function|string[]} predicate The function called per iteration or + * property names to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, predicate) { + var result = {}; + + if (typeof predicate == 'function') { + baseForIn(object, function(value, key, object) { + if (predicate(value, key, object)) { + result[key] = value; + } + }); + return result; + } + var index = -1, + props = predicate, + length = props.length; + + while (++index < length) { + var key = props[index]; + if (key in object) { + result[key] = object[key]; + } + } + return result; + } + + /** + * The base implementation of `_.random` without support for argument juggling + * and returning floating-point numbers. * * @private * @param {number} min The minimum possible value. @@ -970,7 +1053,7 @@ /** * The base implementation of `_.uniq` without support for callback shorthands - * or `this` binding. + * and `this` binding. * * @private * @param {Array} array The array to process. @@ -1030,6 +1113,32 @@ return result; } + /** + * Compiles a function from `source` using the `varNames` and `varValues` + * pairs to import free variables into the compiled function. If `sourceURL` + * is provided it will be used as the sourceURL for the compiled function. + * + * @private + * @param {string} source The source to compile. + * @param {Array} varNames An array of free variable names. + * @param {Array} varValues An array of free variable values. + * @param {string} [sourceURL=''] The sourceURL of the source. + * @returns {Function} Returns the compiled function. + */ + function compileFunction(source, varNames, varValues, sourceURL) { + sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; + try { + // provide the compiled function's source by its `toString` method or + // the `source` property as a convenience for inlining compiled templates + var result = Function(varNames, 'return ' + source + sourceURL).apply(undefined, varValues); + result.source = source; + } catch(e) { + e.source = source; + throw e; + } + return result; + } + /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. @@ -1064,7 +1173,7 @@ * Creates a function that aggregates a collection, creating an accumulator * object composed from the results of running each element in the collection * through a callback. The given setter function sets the keys and values of - * the accumulator object. If `initializer` is provided will be used to + * the accumulator object. If `initializer` is provided it will be used to * initialize the accumulator object. * * @private @@ -1642,7 +1751,7 @@ var index = -1, length = array ? array.length : 0; - start = typeof start == 'undefined' ? 0 : (+start || 0); + start = start == null ? 0 : (+start || 0); if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { @@ -2036,8 +2145,8 @@ /*--------------------------------------------------------------------------*/ /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * Checks if `value` is present in `collection` using strict equality for + * comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the * offset from the end of the collection. * * @static @@ -2456,7 +2565,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|string} methodName The name of the method to invoke or * the function invoked per iteration. - * @param {...*} [args] Arguments to invoke the method with. + * @param {...*} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. * @example * @@ -2467,17 +2576,7 @@ * // => [['1', '2', '3'], ['4', '5', '6']] */ function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection && collection.length, - result = Array(length < 0 ? 0 : length >>> 0); - - baseEach(collection, function(value) { - var func = isFunc ? methodName : (value != null && value[methodName]); - result[++index] = func ? func.apply(value, args) : undefined; - }); - return result; + return baseInvoke(collection, methodName, slice(arguments, 2)); } /** @@ -3214,7 +3313,7 @@ * @category Functions * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * @@ -3244,8 +3343,8 @@ * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodNames] The object method names to bind, specified - * as individual method names or arrays of method names. + * @param {...(string|string[])} [methodNames] The object method names to bind, + * specified as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * @@ -3259,12 +3358,26 @@ * // => logs 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; + return baseBindAll(object, arguments.length > 1 + ? baseFlatten(arguments, true, false, 1) + : functions(object)); + } + + /** + * The base implementation of `_.bindAll` without support for individual + * method name arguments. + * + * @private + * @param {Object} object The object to bind and assign the bound methods to. + * @param {string[]} methodNames The object method names to bind. + * @returns {Object} Returns `object`. + */ + function baseBindAll(object, methodNames) { + var index = -1, + length = methodNames.length; while (++index < length) { - var key = funcs[index]; + var key = methodNames[index]; object[key] = createWrapper(object[key], BIND_FLAG, null, object); } return object; @@ -3469,7 +3582,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to defer. - * @param {...*} [args] Arguments to invoke the function with. + * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * @@ -3493,7 +3606,7 @@ * @category Functions * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [args] Arguments to invoke the function with. + * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * @@ -3636,7 +3749,7 @@ * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. - * @param {...*} [args] Arguments to be partially applied. + * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * @@ -3731,8 +3844,8 @@ * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). + * assigned values. The callback is bound to `thisArg` and invoked with + * five arguments; (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ @@ -3755,20 +3868,20 @@ * defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' }); * // => { 'name': 'barney', 'employer': 'slate' } */ - function assign(object, source, guard) { + function assign(object) { if (!object) { return object; } var args = arguments, - argsIndex = 0, - argsLength = args.length, - type = typeof guard; + index = 0, + length = args.length, + type = typeof args[2]; - if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { - argsLength = 2; + if ((type == 'number' || type == 'string') && args[3] && args[3][args[2]] === args[1]) { + length = 2; } - while (++argsIndex < argsLength) { - source = args[argsIndex]; + while (++index < length) { + var source = args[index]; for (var key in source) { object[key] = source[key]; } @@ -3781,7 +3894,7 @@ * be cloned, otherwise they will be assigned by reference. If a callback * is provided it will be executed to produce the cloned values. If the * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). + * The callback is bound to `thisArg` and invoked with two argument; (value, index|key). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -3848,20 +3961,20 @@ * _.defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' }); * // => { 'name': 'barney', 'employer': 'slate' } */ - function defaults(object, source, guard) { + function defaults(object) { if (!object) { return object; } var args = arguments, - argsIndex = 0, - argsLength = args.length, - type = typeof guard; + index = 0, + length = args.length, + type = typeof args[2]; - if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { - argsLength = 2; + if ((type == 'number' || type == 'string') && args[3] && args[3][args[2]] === args[1]) { + length = 2; } - while (++argsIndex < argsLength) { - source = args[argsIndex]; + while (++index < length) { + var source = args[index]; for (var key in source) { if (typeof object[key] == 'undefined') { object[key] = source[key]; @@ -4106,7 +4219,7 @@ * equivalent. If a callback is provided it will be executed to compare * values. If the callback returns `undefined` comparisons will be handled * by the method instead. The callback is bound to `thisArg` and invoked - * with two arguments; (value, other). + * with three arguments; (value, other, key). * * Note: This method supports comparing arrays, booleans, `Date` objects, * numbers, `Object` objects, regexes, and strings. Functions and DOM nodes @@ -4194,7 +4307,9 @@ * // => false */ function isFunction(value) { - return typeof value == 'function'; + // avoid a Chakra bug in IE 11 + // https://github.com/jashkenas/underscore/issues/1621 + return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { @@ -4207,6 +4322,8 @@ * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * + * Note: See the [ES5 spec](http://es5.github.io/#x8) for more details. + * * @static * @memberOf _ * @category Objects @@ -4224,9 +4341,7 @@ * // => false */ function isObject(value) { - // check if the value is the ECMAScript language type of `Object` - // http://es5.github.io/#x8 - // and avoid a V8 bug + // avoid a V8 bug in Chrome 19-20 // https://code.google.com/p/v8/issues/detail?id=2291 var type = typeof value; return type == 'function' || (value && type == 'object') || false; @@ -4456,13 +4571,16 @@ * // => { 'name': 'fred' } */ function omit(object) { + if (!isObject(object)) { + return {}; + } var omitProps = baseFlatten(arguments, true, false, 1), length = omitProps.length; while (length--) { omitProps[length] = String(omitProps[length]); } - return pick(object, baseDifference(keysIn(object), omitProps)); + return basePick(object, baseDifference(keysIn(object), omitProps)); } /** @@ -4520,18 +4638,9 @@ * // => { 'name': 'fred' } */ function pick(object) { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - return result; + return isObject(object) + ? basePick(object, baseFlatten(arguments, true, false, 1)) + : {}; } /** @@ -4612,7 +4721,7 @@ * settings object is provided it will override `_.templateSettings` for the * template. * - * Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging. + * Note: In the development build, `_.template` utilizes sourceURLs for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * @@ -4630,9 +4739,9 @@ * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The HTML "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. + * @param {Object} [options.imports] An object to import into the template as free variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source. + * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @returns {Function|string} Returns the interpolated string if a data object * is provided, else the compiled template function. @@ -4670,7 +4779,7 @@ * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); * // => '
  • fred
  • barney
  • ' * - * // using the `sourceURL` option to specify a custom `sourceURL` for the template + * // using the `sourceURL` option to specify a custom sourceURL for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector @@ -4734,17 +4843,8 @@ source + 'return __p\n}'; - try { - var result = Function('_', 'return ' + source)(_); - } catch(e) { - e.source = source; - throw e; - } - if (data) { - return result(data); - } - result.source = source; - return result; + var result = compileFunction(source, ['_'], [_]); + return data ? result(data) : result; } /** @@ -5173,7 +5273,7 @@ * @returns {Array} Returns the array of results. * @example * - * var diceRolls = _.times(3, _.partial(_.random, 1, 6)); + * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false)); * // => [3, 6, 4] * * _.times(3, function(n) { mage.castSpell(n); }); @@ -5350,7 +5450,7 @@ /*--------------------------------------------------------------------------*/ // add functions to `lodash.prototype` - mixin(assign({}, lodash)); + mixin(baseAssign({}, lodash)); /** * The semantic version number. @@ -5367,7 +5467,7 @@ // add `Array` mutator functions to the wrapper arrayEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { var value = this.__wrapped__; func.apply(value, arguments); @@ -5383,7 +5483,7 @@ // add `Array` accessor functions to the wrapper arrayEach(['concat', 'join', 'slice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { var value = this.__wrapped__, result = func.apply(value, arguments); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 9b3b9c813..a94de725e 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,39 +3,39 @@ * Lo-Dash 2.4.1 (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(t>>0:0,u=Array(e);++tu(r,i)&&o.push(i)}return o}function g(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number"&&-1o(f,c)&&(t&&f.push(c),i.push(a))}return i}function j(n,r){return function(t,e,u){var o=r?r():{};e=or(e,u,3),u=-1;var i=t?t.length:0;if(typeof i=="number"&&-1r?0:r) -}function k(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?et(u+e,0):e||0;else if(e)return e=q(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function S(n,r,t){return N(n,null==r||t?1:0>r?0:r)}function N(n,r,t){var e=-1,u=n?n.length:0;for(r=typeof r=="undefined"?0:+r||0,0>r?r=et(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=et(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1,t(n[e])u&&(u=t);else r=or(r,t,3),g(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function z(n,r){return D(n,cr(r))}function C(n,r,t,e){var u=3>arguments.length; -r=or(r,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return r=or(r,e,4),h(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function U(n){var r=-1,t=n&&n.length,e=Array(0>t?0:t>>>0);return g(n,function(n){var t=_(++r);e[r]=e[t],e[t]=n}),e}function V(n,r,t){var e;r=or(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length?x(n,pr,r):x(n,pr|gr,r,N(arguments,2))}function H(n,r,t){function e(){l&&clearTimeout(l),i=l=p=lr,(h||g!==r)&&(s=yt(),f=n.apply(c,o),l||i||(o=c=null))}function u(){var t=r-(yt()-a);0>=t||t>r?(i&&clearTimeout(i),t=p,i=l=p=lr,t&&(s=yt(),f=n.apply(c,o),l||i||(o=c=null))):l=setTimeout(u,t)}var o,i,f,a,c,l,p,s=0,g=false,h=true;if(!Y(n))throw new TypeError(vr);if(r=0>r?0:r,true===t)var v=true,h=false;else Z(t)&&(v=t.leading,g="maxWait"in t&&et(r,+t.maxWait||0),h="trailing"in t?t.trailing:h); -return function(){if(o=arguments,a=yt(),c=this,p=h&&(l||!v),false===g)var t=v&&!l;else{i||v||(s=a);var y=g-(a-s),m=0>=y||y>g;m?(i&&(i=clearTimeout(i)),s=a,f=n.apply(c,o)):i||(i=setTimeout(e,y))}return m&&l?l=clearTimeout(l):l||r===g||(l=setTimeout(u,r)),t&&(m=true,f=n.apply(c,o)),!m||l||i||(o=c=null),f}}function J(n){if(!Y(n))throw new TypeError(vr);return function(){return!n.apply(this,arguments)}}function K(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t;for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,dr=/($^)/,_r=/[.*+?^${}()|[\]\/\\]/g,wr=/['\n\r\u2028\u2029\\]/g,jr="[object Arguments]",xr="[object Array]",Tr="[object Boolean]",Ar="[object Date]",Er="[object Number]",Or="[object Object]",kr="[object RegExp]",Sr="[object String]",Nr={"&":"&","<":"<",">":">",'"':""","'":"'"},qr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Fr={"function":true,object:true},Br={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mr=Fr[typeof window]&&window||this,Rr=Fr[typeof exports]&&exports&&!exports.nodeType&&exports,$r=Fr[typeof module]&&module&&!module.nodeType&&module,Ir=Rr&&$r&&typeof global=="object"&&global; -!Ir||Ir.global!==Ir&&Ir.window!==Ir&&Ir.self!==Ir||(Mr=Ir);var Dr=$r&&$r.exports===Rr&&Rr,Wr=Array.prototype,zr=Object.prototype,Cr=Mr._,Pr=Math.pow(2,53)-1,Ur=zr.toString,Vr=RegExp("^"+(null==Ur?"":(Ur+"").replace(_r,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gr=Math.ceil,Hr=Math.floor,Jr=Function.prototype.toString,Kr=zr.hasOwnProperty,Lr=Wr.push,Qr=zr.propertyIsEnumerable,Xr=Wr.splice,Yr=A(Yr=Object.create)&&Yr,Zr=A(Zr=Array.isArray)&&Zr,nt=Mr.isFinite,rt=Mr.isNaN,tt=A(tt=Object.keys)&&tt,et=Math.max,ut=Math.min,ot=A(ot=Date.now)&&ot,it=Math.random; -i.prototype=o.prototype;var ft={};!function(){var n={0:1,length:1};ft.spliceObjects=(Xr.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Yr||(c=function(){function n(){}return function(r){if(Z(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Mr.Object()}}());var at=S,ct=O,lt=j(function(n,r,t){Kr.call(n,t)?n[t]++:n[t]=1}),pt=j(function(n,r,t){Kr.call(n,t)?n[t].push(r):n[t]=[r]}),st=j(function(n,r,t){n[t]=r -}),gt=j(function(n,r,t){n[t?0:1].push(r)},function(){return[[],[]]});X(arguments)||(X=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Kr.call(n,"callee")&&!Qr.call(n,"callee")||false});var ht=Zr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ur.call(n)==xr||false};Y(/x/)&&(Y=function(n){return typeof n=="function"&&"[object Function]"==Ur.call(n)});var vt=tt?function(n){return Z(n)?tt(n):[]}:E,yt=ot||function(){return(new Date).getTime()};o.after=function(n,r){if(!Y(r))throw new TypeError(vr); -return n=nt(n=+n)?n:0,function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=G,o.bindAll=function(n){for(var r=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=vt(n),e=t.length,u={};++ro?0:o>>>0);return g(n,function(n){var o=u?r:null!=n&&n[r];i[++e]=o?o.apply(n,t):lr}),i},o.keys=vt,o.map=D,o.matches=fr,o.max=W,o.memoize=function(n,r){if(!Y(n)||r&&!Y(r))throw new TypeError(vr);var t={};return function(){var e=r?r.apply(this,arguments):arguments[0];return"__proto__"==e?n.apply(this,arguments):Kr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r; -"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number"&&-1o?0:o>>>0);for(t=or(t,e,3),g(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.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!Y(n))throw new TypeError(vr);return false===t?e=false:Z(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),H(n,r,{leading:e,maxWait:r,trailing:u})},o.times=function(n,r,t){n=0>n?0:n>>>0,r=l(r,t,1),t=-1;for(var e=Array(n);++tr?0:r);++nt?et(e+t,0):ut(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.noConflict=function(){return Mr._=Cr,this -},o.now=yt,o.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Hr(it()*(r-n+1))},o.reduce=C,o.reduceRight=P,o.result=function(n,r){if(null!=n){var t=n[r];return Y(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"&&-1n.indexOf(";")?n:n.replace(mr,u))},o.uniqueId=function(n){var r=++yr+"";return n?n+r:r},o.all=M,o.any=V,o.detect=$,o.foldl=C,o.foldr=P,o.include=B,o.inject=C,o.first=O,o.last=function(n,r,t){var e=n?n.length:0; -return null==r||t?n?n[e-1]:lr:(r=e-(r||0),N(n,0>r?0:r))},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=ur(n)),null==r||t?(r=n?n.length:0,0r?0:+r||0,n.length),n)},o.take=ct,o.head=O,ar(K({},o)),o.VERSION="2.4.1",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=Wr[n];o.prototype[n]=function(){var n=this.__wrapped__; -return r.apply(n,arguments),ft.spliceObjects||0!==n.length||delete n[0],this}}),f(["concat","join","slice"],function(n){var r=Wr[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?(Mr._=o, define("underscore",function(){return o})):Rr&&$r?Dr?($r.exports=o)._=o:Rr._=o:Mr._=o}).call(this); \ No newline at end of file +;(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(t>>0:0,u=Array(e);++tu(r,i)&&o.push(i)}return o}function g(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number"&&-1o?0:o>>>0);return g(n,function(n){var o=u?r:null!=n&&n[r];i[++e]=o?o.apply(n,t):sr}),i}function w(n,r){var t={};if(typeof r=="function")return d(n,function(n,e,u){r(n,e,u)&&(t[e]=n)}),t;for(var e=-1,u=r.length;++eo(f,c)&&(t&&f.push(c),i.push(a))}return i}function T(n,r,t,e){try{var u=Function(r,"return "+n+(e?"\n/*\n//# sourceURL="+e+"\n*/":"")).apply(sr,t);u.source=n}catch(o){throw o.source=n,o}return u}function A(n,r){return function(t,e,u){var o=r?r():{};e=fr(e,u,3),u=-1;var i=t?t.length:0;if(typeof i=="number"&&-1r?0:r) +}function q(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?ot(u+e,0):e||0;else if(e)return e=B(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function F(n,r,t){return R(n,null==r||t?1:0>r?0:r)}function R(n,r,t){var e=-1,u=n?n.length:0;for(r=null==r?0:+r||0,0>r?r=ot(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=ot(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1,t(n[e])u&&(u=t);else r=fr(r,t,3),g(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function L(n,r){return U(n,pr(r))}function P(n,r,t,e){var u=3>arguments.length; +r=fr(r,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return r=fr(r,e,4),h(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function G(n){var r=-1,t=n&&n.length,e=Array(0>t?0:t>>>0);return g(n,function(n){var t=j(0,++r);e[r]=e[t],e[t]=n}),e}function H(n,r,t){var e;(typeof r!="function"||typeof t!="undefined")&&(r=fr(r,t,3)),t=-1;var u=n?n.length:0; +if(typeof u=="number"&&-1arguments.length?E(n,gr,null,r):E(n,gr|vr,null,r,R(arguments,2))}function K(n,r,t){var e,u,o,i,f,a,c,l=0,p=false,s=true;if(!rr(n))throw new TypeError(mr);if(r=0>r?0:r,true===t)var g=true,s=false;else tr(t)&&(g=t.leading,p="maxWait"in t&&ot(r,+t.maxWait||0),s="trailing"in t?t.trailing:s);var h=function(){var t=r-(dt()-i);0>=t||t>r?(u&&clearTimeout(u),t=c,u=a=c=sr,t&&(l=dt(),o=n.apply(f,e),a||u||(e=f=null))):a=setTimeout(h,t) +},v=function(){a&&clearTimeout(a),u=a=c=sr,(s||p!==r)&&(l=dt(),o=n.apply(f,e),a||u||(e=f=null))};return function(){if(e=arguments,i=dt(),f=this,c=s&&(a||!g),false===p)var t=g&&!a;else{u||g||(l=i);var y=p-(i-l),m=0>=y||y>p;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o}}function Q(n){if(!rr(n))throw new TypeError(mr);return function(){return!n.apply(this,arguments)}}function X(n){if(!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=/($^)/,jr=/[.*+?^${}()|[\]\/\\]/g,xr=/['\n\r\u2028\u2029\\]/g,Tr="[object Arguments]",Ar="[object Array]",Er="[object Boolean]",Or="[object Date]",kr="[object Number]",Sr="[object Object]",Nr="[object RegExp]",qr="[object String]",Fr={"&":"&","<":"<",">":">",'"':""","'":"'"},Rr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Br={"function":true,object:true},Mr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$r=Br[typeof window]&&window||this,Ir=Br[typeof exports]&&exports&&!exports.nodeType&&exports,Dr=Br[typeof module]&&module&&!module.nodeType&&module,Wr=Ir&&Dr&&typeof global=="object"&&global; +!Wr||Wr.global!==Wr&&Wr.window!==Wr&&Wr.self!==Wr||($r=Wr);var zr=Dr&&Dr.exports===Ir&&Ir,Ur=Array.prototype,Cr=Object.prototype,Lr=$r._,Pr=Math.pow(2,53)-1,Vr=Cr.toString,Gr=RegExp("^"+(null==Vr?"":(Vr+"").replace(jr,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hr=Math.ceil,Jr=Math.floor,Kr=Function.prototype.toString,Qr=Cr.hasOwnProperty,Xr=Ur.push,Yr=Cr.propertyIsEnumerable,Zr=Ur.splice,nt=k(nt=Object.create)&&nt,rt=k(rt=Array.isArray)&&rt,tt=$r.isFinite,et=$r.isNaN,ut=k(ut=Object.keys)&&ut,ot=Math.max,it=Math.min,ft=k(ft=Date.now)&&ft,at=Math.random; +i.prototype=o.prototype;var ct={};!function(n){n={0:1,length:1},ct.spliceObjects=(Zr.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},nt||(c=function(){function n(){}return function(r){if(tr(r)){n.prototype=r;var t=new n;n.prototype=null}return t||$r.Object()}}());var lt=F,pt=N,st=A(function(n,r,t){Qr.call(n,t)?n[t]++:n[t]=1}),gt=A(function(n,r,t){Qr.call(n,t)?n[t].push(r):n[t]=[r]}),ht=A(function(n,r,t){n[t]=r +}),vt=A(function(n,r,t){n[t?0:1].push(r)},function(){return[[],[]]});nr(arguments)||(nr=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Qr.call(n,"callee")&&!Yr.call(n,"callee")||false});var yt=rt||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Vr.call(n)==Ar||false};rr(/x/)&&(rr=function(n){return typeof n=="function"&&"[object Function]"==Vr.call(n)});var mt=ut?function(n){return tr(n)?ut(n):[]}:S,dt=ft||function(){return(new Date).getTime()};o.after=function(n,r){if(!rr(r))throw new TypeError(mr); +return n=tt(n=+n)?n:0,function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=J,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=mt(n),e=t.length,u={};++ro?0:o>>>0);for(t=fr(t,e,3),g(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.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!rr(n))throw new TypeError(mr);return false===t?e=false:tr(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),K(n,r,{leading:e,maxWait:r,trailing:u})},o.times=function(n,r,t){n=0>n?0:n>>>0,r=l(r,t,1),t=-1;for(var e=Array(n);++tr?0:r);++nt?ot(e+t,0):it(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.noConflict=function(){return $r._=Lr,this +},o.now=dt,o.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Jr(at()*(r-n+1))},o.reduce=P,o.reduceRight=V,o.result=function(n,r){if(null!=n){var t=n[r];return rr(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"&&-1n.indexOf(";")?n:n.replace(br,u))},o.uniqueId=function(n){var r=++dr+"";return n?n+r:r},o.all=I,o.any=H,o.detect=W,o.foldl=P,o.foldr=V,o.include=$,o.inject=P,o.first=N,o.last=function(n,r,t){var e=n?n.length:0;return null==r||t?n?n[e-1]:sr:(r=e-(r||0),R(n,0>r?0:r)) +},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=ir(n)),null==r||t?(r=n?n.length:0,0r?0:+r||0,n.length),n)},o.take=pt,o.head=N,lr(function(n,r,t){if(!n)return n;for(var e=-1,u=mt(r),o=u.length;++e