diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 511eef9e1..20bfcb652 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -70,7 +70,7 @@ /** Used to match `RegExp` flags from their coerced string values */ var reFlags = /\w*$/; - /** Used to detected named functions */ + /** Used to detect named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; /** Used to detect hexadecimal string values */ @@ -529,6 +529,19 @@ return typeof value.toString != 'function' && typeof (value + '') == 'string'; } + /** + * Used by `_.trimmedLeftIndex` and `_.trimmedRightIndex` to determine if a + * character code is whitespace. + * + * @private + * @param {number} charCode The character code to inspect. + * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. + */ + function isWhitespace(charCode) { + return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || + (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); + } + /** * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace * character of `string`. @@ -541,13 +554,7 @@ var index = -1, length = string.length; - while (++index < length) { - var c = string.charCodeAt(index); - if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || - (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)))) { - break; - } - } + while (++index < length && isWhitespace(string.charCodeAt(index))) { } return index; } @@ -562,13 +569,7 @@ function trimmedRightIndex(string) { var index = string.length; - while (index--) { - var c = string.charCodeAt(index); - if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || - (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)))) { - break; - } - } + while (index-- && isWhitespace(string.charCodeAt(index))) { } return index; } @@ -745,14 +746,14 @@ * `chain`, `chunk`, `compact`, `compose`, `concat`, `constant`, `countBy`, * `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `keysIn`, `map`, `mapValues`, `matches`, `memoize`, `merge`, - * `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, - * `partition`, `pick`, `pluck`, `property`, `pull`, `pullAt`, `push`, `range`, - * `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, - * `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, - * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `flattenDeep`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `keysIn`, `map`, `mapValues`, `matches`, `memoize`, + * `merge`, `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, + * `partialRight`, `partition`, `pick`, `pluck`, `property`, `pull`, `pullAt`, + * `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, + * `sort`, `sortBy`, `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, * `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, * and `zipObject` * @@ -1057,6 +1058,26 @@ /*--------------------------------------------------------------------------*/ + /** + * Appends placeholder indexes to `array` adding `offset` to each appended index. + * + * @private + * @param {Array} array The array of placeholder indexes to append to. + * @param {Array} indexes The array of placeholder indexes to append. + * @param {number} offset The placeholder offset. + * @returns {Array} Returns `array`. + */ + function appendHolders(array, indexes, offset) { + var length = array.length, + index = indexes.length; + + array.length += index; + while (index--) { + array[length + index] = indexes[index] + offset; + } + return array; + } + /** * A specialized version of `_.forEach` for arrays without support for * callback shorthands or `this` binding. @@ -1068,7 +1089,7 @@ */ function arrayEach(array, iterator) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (iterator(array[index], index, array) === false) { @@ -1088,7 +1109,7 @@ * @returns {Array} Returns `array`. */ function arrayEachRight(array, iterator) { - var length = array ? array.length : 0; + var length = array.length; while (length--) { if (iterator(array[length], length, array) === false) { @@ -1131,7 +1152,7 @@ */ function arrayMap(array, iterator) { var index = -1, - length = array ? array.length : 0, + length = array.length, result = Array(length); while (++index < length) { @@ -1291,6 +1312,26 @@ return 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 = methodNames[index]; + object[key] = createWrapper([object[key], BIND_FLAG, null, object]); + } + return object; + } + /** * The base implementation of `_.callback` without support for creating * "_.pluck" and "_.where" style callbacks. @@ -1427,7 +1468,8 @@ if (Ctor instanceof Ctor) { Ctor = ctorByClass[className]; } - return new Ctor(cloneBuffer(value.buffer), value.byteOffset, value.length); + var buffer = value.buffer; + return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, value.byteOffset, value.length); case numberClass: case stringClass: @@ -1503,18 +1545,7 @@ * sets its metadata. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {number} data[1] The bitmask of flags to compose. See `createWrapper` - * for more details. - * @param {number} data[2] The arity of `data[0]`. - * @param {*} [data[3]] The `this` binding of `data[0]`. - * @param {Array} [data[4]] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [data[5]] An array of arguments to append to those - * provided to the new function. - * @param {Array} [data[6]] An array of `data[4]` placeholder indexes. - * @param {Array} [data[7]] An array of `data[5]` placeholder indexes. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new function. */ function baseCreateWrapper(data) { @@ -1522,7 +1553,7 @@ if (bitmask == BIND_FLAG) { return setData(createBindWrapper(data), data); } - var partialHolders = data[6]; + var partialHolders = data[5]; if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !partialHolders.length) { return setData(createPartialWrapper(data), data); } @@ -1530,7 +1561,7 @@ arity = data[2], thisArg = data[3], partialArgs = data[4], - partialRightArgs = data[5], + partialRightArgs = data[6], partialRightHolders = data[7]; var isBind = bitmask & BIND_FLAG, @@ -1557,7 +1588,9 @@ args = composeArgsRight(partialRightArgs, partialRightHolders, args); } if (isCurry || isCurryRight) { - var newPartialHolders = getHolders(args); + var placeholder = wrapper.placeholder, + newPartialHolders = getHolders(args, placeholder); + length -= newPartialHolders.length; if (length < arity) { @@ -1567,10 +1600,13 @@ if (!isCurryBound) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } - var newData = [func, bitmask, nativeMax(arity - length, 0), thisArg]; - newData[isCurry ? 4 : 5] = args; - newData[isCurry ? 6 : 7] = newPartialHolders; - return baseCreateWrapper(newData); + var newData = [func, bitmask, nativeMax(arity - length, 0), thisArg, null, null]; + newData[isCurry ? 4 : 6] = args; + newData[isCurry ? 5 : 7] = newPartialHolders; + + var result = baseCreateWrapper(newData); + result.placeholder = placeholder; + return result; } } var thisBinding = isBind ? thisArg : this; @@ -1597,7 +1633,7 @@ if (typeof arity != 'number') { arity = +arity || (func ? func.length : 0); } - return createWrapper(func, bitmask, arity); + return createWrapper([func, bitmask, arity]); } /** @@ -2224,15 +2260,19 @@ * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new partially applied function. */ - function basePartial(func, bitmask, args, thisArg) { + function basePartial(func, bitmask, args, holders, thisArg) { if (func) { var data = func[EXPANDO], arity = data ? data[2] : func.length; arity -= args.length; } - var isPartial = bitmask & PARTIAL_FLAG; - return createWrapper(func, bitmask, arity, thisArg, isPartial && args, !isPartial && args); + var isPartial = bitmask & PARTIAL_FLAG, + newData = [func, bitmask, arity, thisArg, null, null]; + + newData[isPartial ? 4 : 6] = args; + newData[isPartial ? 5 : 7] = holders; + return createWrapper(newData); } /** @@ -2589,9 +2629,7 @@ * with its associated `this` binding. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {*} data[3] The `this` binding of `data[0]`. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new bound function. */ function createBindWrapper(data) { @@ -2670,22 +2708,15 @@ * with its associated partially applied arguments and optional `this` binding. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {number} data[1] The bitmask of flags to compose. See `createWrapper` - * for more details. - * @param {*} [data[3]] The `this` binding of `data[0]`. - * @param {Array} data[4] An array of arguments to prepend to those - * provided to the new function. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new bound function. */ function createPartialWrapper(data) { var func = data[0], - bitmask = data[1], thisArg = data[3], partialArgs = data[4]; - var isBind = bitmask & BIND_FLAG, + var isBind = data[1] & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { @@ -2709,29 +2740,35 @@ } /** - * Creates a function that either curries or invokes `func` with an optional + * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of flags to compose. + * @param {Array} data The metadata array. + * @param {Function|string} data[0] The function or method name to reference. + * @param {number} data[1] The bitmask of flags to compose. * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curryRight` - * 16 - `_.curry` or `_.curryRight` of a bound function - * 32 - `_.partial` - * 64 - `_.partialRight` - * @param {number} [arity] The arity of `func`. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partialArgs] An array of arguments to prepend to those + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` + * 8 - `_.curryRight` + * 16 - `_.curry` or `_.curryRight` of a bound function + * 32 - `_.partial` + * 64 - `_.partialRight` + * @param {number} data[2] The arity of `data[0]`. + * @param {*} [data[3]] The `this` binding of `data[0]`. + * @param {Array} [data[4]] An array of arguments to prepend to those * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those + * @param {Array} [data[5]] An array of `data[4]` placeholder indexes. + * @param {Array} [data[6]] An array of arguments to append to those * provided to the new function. + * @param {Array} [data[7]] An array of `data[6]` placeholder indexes. * @returns {Function} Returns the new function. */ - function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs) { + function createWrapper(data) { + var func = data[0], + bitmask = data[1]; + var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isPartial = bitmask & PARTIAL_FLAG, @@ -2740,35 +2777,43 @@ if (!isBindKey && !isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } + var arity = data[2], + partialArgs = data[4], + partialRightArgs = data[6]; + if (isPartial && !partialArgs.length) { - bitmask &= ~PARTIAL_FLAG; - isPartial = partialArgs = false; + isPartial = false; + data[1] = (bitmask &= ~PARTIAL_FLAG); + data[4] = data[5] = partialArgs = null; } if (isPartialRight && !partialRightArgs.length) { - bitmask &= ~PARTIAL_RIGHT_FLAG; - isPartialRight = partialRightArgs = false; + isPartialRight = false; + data[1] = (bitmask &= ~PARTIAL_RIGHT_FLAG); + data[6] = data[7] = partialRightArgs = null; } - var data = !isBindKey && func[EXPANDO]; - if (data && data !== true) { - // shallow clone `data` - data = slice(data); + var funcData = !isBindKey && func[EXPANDO]; + if (funcData && funcData !== true) { + // shallow clone `funcData` + funcData = slice(funcData); // clone partial left arguments - if (data[4]) { - data[4] = slice(data[4]); + if (funcData[4]) { + funcData[4] = slice(funcData[4]); + funcData[5] = slice(funcData[5]); } // clone partial right arguments - if (data[5]) { - data[5] = slice(data[5]); + if (funcData[6]) { + funcData[6] = slice(funcData[6]); + funcData[7] = slice(funcData[7]); } // set arity if provided if (typeof arity == 'number') { - data[2] = arity; + funcData[2] = arity; } // set `thisArg` if not previously bound - var bound = data[1] & BIND_FLAG; + var bound = funcData[1] & BIND_FLAG; if (isBind && !bound) { - data[3] = thisArg; + funcData[3] = data[3]; } // set if currying a bound function if (!isBind && bound) { @@ -2776,35 +2821,39 @@ } // append partial left arguments if (isPartial) { - if (data[4]) { - push.apply(data[4], partialArgs); + var partialHolders = data[5], + funcPartialArgs = funcData[4]; + + if (funcPartialArgs) { + appendHolders(funcData[5], partialHolders, funcPartialArgs.length); + push.apply(funcPartialArgs, partialArgs); } else { - data[4] = partialArgs; + funcData[4] = partialArgs; + funcData[5] = partialHolders; } } // prepend partial right arguments if (isPartialRight) { - if (data[5]) { - unshift.apply(data[5], partialRightArgs); + var partialRightHolders = data[7], + funcPartialRightArgs = funcData[6]; + + if (funcPartialRightArgs) { + appendHolders(funcData[7], partialRightHolders, funcPartialRightArgs.length); + unshift.apply(funcPartialRightArgs, partialRightArgs); } else { - data[5] = partialRightArgs; + funcData[6] = partialRightArgs; + funcData[7] = partialRightHolders; } } // merge flags - data[1] |= bitmask; - return createWrapper.apply(undefined, data); - } - if (isPartial) { - var partialHolders = getHolders(partialArgs); - } - if (isPartialRight) { - var partialRightHolders = getHolders(partialRightArgs); + funcData[1] |= bitmask; + return createWrapper(funcData); } if (arity == null) { arity = isBindKey ? 0 : func.length; } - arity = nativeMax(arity, 0); - return baseCreateWrapper([func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]); + data[2] = nativeMax(arity, 0); + return baseCreateWrapper(data); } /** @@ -2829,13 +2878,13 @@ * @param {Array} array The array to inspect. * @returns {Array} Returns the new array of placeholder indexes. */ - function getHolders(array) { + function getHolders(array, placeholder) { var index = -1, length = array.length, result = []; while (++index < length) { - if (array[index] === lodash) { + if (array[index] === placeholder) { result.push(index); } } @@ -3042,8 +3091,8 @@ * Converts `collection` to an array if it is not an array-like value. * * @private - * @param {Array|Object|string} collection The collection to inspect. - * @returns {Array|Object} Returns the iterable object. + * @param {Array|Object|string} collection The collection to process. + * @returns {Array} Returns the iterable object. */ function toIterable(collection) { var length = collection ? collection.length : 0; @@ -3465,6 +3514,24 @@ return baseFlatten(array, isDeep); } + /** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2], [3, [[4]]]]); + * // => [1, 2, 3, 4]; + */ + function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true) : []; + } + /** * Gets the index at which the first occurrence of `value` is found in `array` * using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, @@ -5624,9 +5691,13 @@ * // => 'hi fred' */ function bind(func, thisArg) { - return arguments.length < 3 - ? createWrapper(func, BIND_FLAG, null, thisArg) - : basePartial(func, BIND_FLAG | PARTIAL_FLAG, slice(arguments, 2), thisArg); + if (arguments.length < 3) { + return createWrapper([func, BIND_FLAG, null, thisArg]); + } + var args = slice(arguments, 2), + partialHolders = getHolders(args, bind.placeholder); + + return basePartial(func, BIND_FLAG | PARTIAL_FLAG, args, partialHolders, thisArg); } /** @@ -5663,26 +5734,6 @@ ); } - /** - * 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 = methodNames[index]; - object[key] = createWrapper(object[key], BIND_FLAG, null, object); - } - return object; - } - /** * Creates a function that invokes the method at `object[key]` and prepends * any additional `bindKey` arguments to those provided to the bound function. @@ -5719,9 +5770,12 @@ * // => 'hiya fred!' */ function bindKey(object, key) { - return arguments.length < 3 - ? createWrapper(key, BIND_FLAG | BIND_KEY_FLAG, null, object) - : createWrapper(key, BIND_FLAG | BIND_KEY_FLAG | PARTIAL_FLAG, null, object, slice(arguments, 2)); + var data = [key, BIND_FLAG | BIND_KEY_FLAG, null, object]; + if (arguments.length > 2) { + var args = slice(arguments, 2); + data.push(args, getHolders(args, bindKey.placeholder)); + } + return createWrapper(data); } /** @@ -5809,7 +5863,9 @@ * // => [1, 2, 3] */ function curry(func, arity) { - return baseCurry(func, CURRY_FLAG, arity); + var result = baseCurry(func, CURRY_FLAG, arity); + result.placeholder = curry.placeholder; + return result; } /** @@ -5840,7 +5896,9 @@ * // => [1, 2, 3] */ function curryRight(func, arity) { - return baseCurry(func, CURRY_RIGHT_FLAG, arity); + var result = baseCurry(func, CURRY_RIGHT_FLAG, arity); + result.placeholder = curryRight.placeholder; + return result; } /** @@ -5855,6 +5913,9 @@ * the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * * @static * @memberOf _ * @category Function @@ -6186,7 +6247,10 @@ * // => 'hello fred' */ function partial(func) { - return basePartial(func, PARTIAL_FLAG, slice(arguments, 1)); + var args = slice(arguments, 1), + partialHolders = getHolders(args, partial.placeholder); + + return basePartial(func, PARTIAL_FLAG, args, partialHolders); } /** @@ -6221,7 +6285,10 @@ * // => { 'a': { 'b': { 'c': 1, 'd': 2 } } } */ function partialRight(func) { - return basePartial(func, PARTIAL_RIGHT_FLAG, slice(arguments, 1)); + var args = slice(arguments, 1), + partialHolders = getHolders(args, partialRight.placeholder); + + return basePartial(func, PARTIAL_RIGHT_FLAG, args, partialHolders); } /** @@ -6236,6 +6303,9 @@ * the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.throttle` and `_.debounce`. + * * @static * @memberOf _ * @category Function @@ -6275,7 +6345,6 @@ debounceOptions.leading = leading; debounceOptions.maxWait = +wait; debounceOptions.trailing = trailing; - return debounce(func, wait, debounceOptions); } @@ -6301,7 +6370,7 @@ * // => '

fred, barney, & pebbles

' */ function wrap(value, wrapper) { - return createWrapper(wrapper, PARTIAL_FLAG, null, null, [value]); + return basePartial(wrapper, PARTIAL_FLAG, [value], []); } /*--------------------------------------------------------------------------*/ @@ -8091,6 +8160,7 @@ * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. + * @param- {Object} [otherOptions] Enables the legacy `options` param signature. * @returns {Function} Returns the compiled template function. * @example * @@ -8158,13 +8228,13 @@ * };\ * '); */ - function template(string, options) { + function template(string, options, otherOptions) { // based on John Resig's `tmpl` implementation // http://ejohn.org/blog/javascript-micro-templating/ // and Laura Doktorova's doT.js // https://github.com/olado/doT var settings = lodash.templateSettings; - options = assign({}, options, settings, assignOwnDefaults); + options = assign({}, otherOptions || options, settings, assignOwnDefaults); string = String(string == null ? '' : string); var imports = assign({}, options.imports, settings.imports, assignOwnDefaults), @@ -9037,6 +9107,9 @@ // ensure `new lodashWrapper` is an instance of `lodash` lodashWrapper.prototype = lodash.prototype; + // assign default placeholders + bind.placeholder = bindKey.placeholder = curry.placeholder = curryRight.placeholder = partial.placeholder = partialRight.placeholder = lodash; + // add functions that return wrapped values when chaining lodash.after = after; lodash.assign = assign; @@ -9066,6 +9139,7 @@ lodash.dropWhile = dropWhile; lodash.filter = filter; lodash.flatten = flatten; + lodash.flattenDeep = flattenDeep; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 0891d946b..6d593502f 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,70 +4,71 @@ * Build: `lodash -o ./dist/lodash.compat.js` */ ;(function(){function n(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202i(t,f)&&c.push(f);return c}function zt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>k)return Ht(n,t);for(var e=-1,u=Sr(n);++e=r||r>k)return Qt(n,t);for(var e=Sr(n);r--&&false!==t(e[r],r,n););return n}function Zt(n,t){var r=true;return zt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Kt(n,t){var r=[];return zt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Vt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Yt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,a=r(n[i]);(e?a<=t:ao(l,p)&&((t||f)&&l.push(p),c.push(s))}return c}function pr(n,t){for(var r=-1,e=t(n),u=e.length,o=xe(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?lu(u+e,0):e||0;else if(e)return e=Lr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Ur(n){return Tr(n,1)}function Tr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=lu(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=lu(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=xe(u);++er?lu(e+r,0):r||0:0,typeof n=="string"||!Cu(n)&&pe(n)?ro&&(o=a);else t=i&&a?u:br(t,r,3),zt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n) -});return o}function Jr(n,t){return Vr(n,Ae(t))}function Xr(n,t,r,e){return(Cu(n)?St:fr)(n,br(t,e,4),r,3>arguments.length,zt)}function Gr(n,t,r,e){return(Cu(n)?Rt:fr)(n,br(t,e,4),r,3>arguments.length,qt)}function Hr(n){n=Sr(n);for(var t=-1,r=n.length,e=xe(r);++t=r||r>t?(a&&Ke(a),r=p,a=s=p=d,r&&(h=Wu(),f=n.apply(l,i),s||a||(i=l=null))):s=nu(e,r)}function u(){s&&Ke(s),a=s=p=d,(v||g!==t)&&(h=Wu(),f=n.apply(l,i),s||a||(i=l=null))}function o(){if(i=arguments,c=Wu(),l=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=c);var o=g-(c-h),m=0>=o||o>g;m?(a&&(a=Ke(a)),h=c,f=n.apply(l,i)):a||(a=nu(u,o))}return m&&s?s=Ke(s):s||t===g||(s=nu(e,t)),r&&(m=true,f=n.apply(l,i)),!m||s||a||(i=l=null),f}var i,a,f,c,l,s,p,h=0,g=false,v=true; -if(!fe(n))throw new Ue(C);if(t=0>t?0:t,true===r)var y=true,v=false;else ce(r)&&(y=r.leading,g="maxWait"in r&&lu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Ke(s),a&&Ke(a),a=s=p=d},o}function re(n){if(!fe(n))throw new Ue(C);return function(){return!n.apply(this,arguments)}}function ee(n){return or(n,E,Tr(arguments,1))}function ue(n){return nr(n,he)}function oe(n){return n&&typeof n=="object"&&typeof n.length=="number"&&De.call(n)==tt||false}function ie(n){return n&&typeof n=="object"&&1===n.nodeType&&(_u.nodeClass?-1t||null==n||!fu(t))return r;n=Fe(n);do t%2&&(r+=n),t=Ye(t/2),n+=n; -while(t);return r}function me(n,t){return(n=null==n?"":Fe(n))?null==t?n.slice(g(n),v(n)+1):(t=Fe(t),n.slice(o(n,t),i(n,t)+1)):n}function de(n){try{return n()}catch(t){return ae(t)?t:Oe(t)}}function _e(n,t){return Nt(n,t)}function be(n){return n}function we(n){var t=Ru(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Er(u))return function(n){return null!=n&&u===n[e]&&Xe.call(n,e)}}for(var o=r,i=xe(r),a=xe(r);o--;){var u=n[t[o]],f=Er(u);i[o]=f,a[o]=f?u:Pt(u,false)}return function(n){if(o=r,null==n)return!o; -for(;o--;)if(i[o]?a[o]!==n[t[o]]:!Xe.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!Xe.call(n,t[o]):!tr(a[o],n[t[o]],null,true))return false;return true}}function je(n,t,r){var e=true,u=t&&nr(t,Ru);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=nr(t,Ru)),false===r?e=false:ce(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=fe(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},K.assign=Iu,K.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1arguments.length?_r(n,b,null,t):or(n,b|E,Tr(arguments,2),t)},K.bindAll=function(n){for(var t=n,r=1arguments.length?_r(t,b|w,null,n):_r(t,b|w|E,null,n,Tr(arguments,2))},K.callback=_e,K.chain=function(n){return n=K(n),n.__chain__=true,n},K.chunk=function(n,t){var r=0,e=n?n.length:0,u=[];for(t=lu(+t||1,1);rt?0:t)},K.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Tr(n,0,0>t?0:t)},K.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--&&t(n[e],e,n););return Tr(n,0,e+1) -},K.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=br(t,r,3);++e(p?e(p,f):i(s,f))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,f):i(n[t],f)))continue n -}p&&p.push(f),s.push(f)}return s},K.invert=function(n,t){for(var r=-1,e=Ru(n),u=e.length,o={};++rt?0:t)},K.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Tr(n,0>t?0:t)},K.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--&&t(n[e],e,n););return Tr(n,e+1)},K.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=br(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},K.escape=function(n){return n=null==n?"":Fe(n),N.lastIndex=0,N.test(n)?n.replace(N,s):n -},K.escapeRegExp=ve,K.every=Mr,K.find=qr,K.findIndex=kr,K.findKey=function(n,t,r){return t=br(t,r,3),Vt(n,t,Ht,true)},K.findLast=function(n,t,r){return t=br(t,r,3),Vt(n,t,qt)},K.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},K.findLastKey=function(n,t,r){return t=br(t,r,3),Vt(n,t,Qt,true)},K.findWhere=function(n,t){return qr(n,we(t))},K.first=Rr,K.has=function(n,t){return n?Xe.call(n,t):false},K.identity=be,K.indexOf=Fr,K.isArguments=oe,K.isArray=Cu,K.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&De.call(n)==et||false -},K.isDate=function(n){return n&&typeof n=="object"&&De.call(n)==ut||false},K.isElement=ie,K.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?lu(u+r,0):su(r||0,u-1))+1;else if(r)return u=Wr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},K.max=Yr,K.min=function(n,t,r){var e=1/0,o=e,i=typeof t;"number"!=i&&"string"!=i||!r||r[t]!==n||(t=null);var i=null==t,a=!(i&&Cu(n))&&pe(n);if(i&&!a)for(r=-1,n=Sr(n),i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},K.template=function(n,t){var r=K.templateSettings;t=Iu({},t,r,Lt),n=Fe(null==n?"":n); -var e,u,r=Iu({},t.imports,r.imports,Lt),o=Ru(r),i=ge(r),a=0,r=t.interpolate||V,f="__p+='",r=Re((t.escape||V).source+"|"+r.source+"|"+(r===B?D:V).source+"|"+(t.evaluate||V).source+"|$","g");if(n.replace(r,function(t,r,o,i,c,l){return o||(o=i),f+=n.slice(a,l).replace(X,p),r&&(e=true,f+="'+__e("+r+")+'"),c&&(u=true,f+="';"+c+";\n__p+='"),o&&(f+="'+((__t=("+o+"))==null?'':__t)+'"),a=l+t.length,t}),f+="';",(r=t.variable)||(f="with(obj){"+f+"}"),f=(u?f.replace(U,""):f).replace(T,"$1").replace(L,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(e?",__e=_.escape":"")+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}",r=de(function(){return Ie(o,"return "+f).apply(d,i) -}),r.source=f,ae(r))throw r;return r},K.trim=me,K.trimLeft=function(n,t){return(n=null==n?"":Fe(n))?null==t?n.slice(g(n)):(t=Fe(t),n.slice(o(n,t))):n},K.trimRight=function(n,t){return(n=null==n?"":Fe(n))?null==t?n.slice(0,v(n)+1):(t=Fe(t),n.slice(0,i(n,t)+1)):n},K.trunc=function(n,t){var r=30,e="...";if(ce(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Fe(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Fe(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e; -if(r=n.slice(0,o),null==u)return r+e;if(se(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Re(u.source,(M.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Ht(K,function(n,t){var r="sample"!=t;K.prototype[t]||(K.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new G(o,u):o})}),K.VERSION=_,K.prototype.chain=function(){return this.__chain__=true,this},K.prototype.toJSON=Br,K.prototype.toString=function(){return Fe(this.__wrapped__) -},K.prototype.value=Br,K.prototype.valueOf=Br,Et(["join","pop","shift"],function(n){var t=Te[n];K.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new G(r,n):r}}),Et(["push","reverse","sort","unshift"],function(n){var t=Te[n];K.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Et(["concat","splice"],function(n){var t=Te[n];K.prototype[n]=function(){return new G(t.apply(this.__wrapped__,arguments),this.__chain__)}}),_u.spliceObjects||Et(["pop","shift","splice"],function(n){var t=Te[n],r="splice"==n; -K.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new G(u,n):u}}),K}var d,_="3.0.0-pre",b=1,w=2,j=4,A=8,x=16,E=32,O=64,I="__lodash@"+_+"__",C="Expected a function",S=Math.pow(2,32)-1,k=Math.pow(2,53)-1,R=0,F=/^[A-Z]+$/,U=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,L=/(__e\(.*?\)|\b__t\))\+'';/g,W=/&(?:amp|lt|gt|quot|#39|#96);/g,N=/[&<>"'`]/g,P=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,Z=/^\[object .+?Constructor\]$/,K=/[\xC0-\xFF]/g,V=/($^)/,Y=/[.*+?^${}()|[\]\/\\]/g,J=/\bthis\b/,X=/['\n\r\u2028\u2029\\]/g,G=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,H=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Q="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),nt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Error]",it="[object Function]",at="[object Number]",ft="[object Object]",ct="[object RegExp]",lt="[object String]",st="[object ArrayBuffer]",pt="[object Float32Array]",ht="[object Float64Array]",gt="[object Int8Array]",vt="[object Int16Array]",yt="[object Int32Array]",mt="[object Uint8Array]",dt="[object Uint8ClampedArray]",_t="[object Uint16Array]",bt="[object Uint32Array]",wt={}; -wt[tt]=wt[rt]=wt[pt]=wt[ht]=wt[gt]=wt[vt]=wt[yt]=wt[mt]=wt[dt]=wt[_t]=wt[bt]=true,wt[st]=wt[et]=wt[ut]=wt[ot]=wt[it]=wt["[object Map]"]=wt[at]=wt[ft]=wt[ct]=wt["[object Set]"]=wt[lt]=wt["[object WeakMap]"]=false;var jt={};jt[tt]=jt[rt]=jt[st]=jt[et]=jt[ut]=jt[pt]=jt[ht]=jt[gt]=jt[vt]=jt[yt]=jt[at]=jt[ft]=jt[ct]=jt[lt]=jt[mt]=jt[dt]=jt[_t]=jt[bt]=true,jt[ot]=jt[it]=jt["[object Map]"]=jt["[object Set]"]=jt["[object WeakMap]"]=false;var At={leading:false,maxWait:0,trailing:false},xt={configurable:false,enumerable:false,value:null,writable:false},Et={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ot={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},It={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},Ct={"function":true,object:true},St={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},kt=Ct[typeof window]&&window||this,Rt=Ct[typeof exports]&&exports&&!exports.nodeType&&exports,Ct=Ct[typeof module]&&module&&!module.nodeType&&module,Ft=Rt&&Ct&&typeof global=="object"&&global; -!Ft||Ft.global!==Ft&&Ft.window!==Ft&&Ft.self!==Ft||(kt=Ft);var Ft=Ct&&Ct.exports===Rt&&Rt,Ut=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(kt._=Ut, define(function(){return Ut})):Rt&&Ct?Ft?(Ct.exports=Ut)._=Ut:Rt._=Ut:kt._=Ut}).call(this); \ No newline at end of file +}function a(n,r){return t(n.a,r.a)||n.b-r.b}function f(n,r){for(var e=-1,u=n.a,o=r.a,i=u.length;++e=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n) +}function v(n){for(var t=-1,r=n.length;++ti(t,f)&&l.push(f);return l}function qt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>k)return Qt(n,t);for(var e=-1,u=Rr(n);++e=r||r>k)return nr(n,t);for(var e=Rr(n);r--&&false!==t(e[r],r,n););return n}function Kt(n,t){var r=true;return qt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Vt(n,t){var r=[];return qt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Yt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Jt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,a=r(n[i]); +(e?a<=t:ao(c,p)&&((t||f)&&c.push(p),l.push(s))}return l}function hr(n,t){for(var r=-1,e=t(n),u=e.length,o=Re(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?yu(u+e,0):e||0;else if(e)return e=Wr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Tr(n){return Lr(n,1)}function Lr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=yu(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=yu(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Re(u);++er?yu(e+r,0):r||0:0,typeof n=="string"||!Tu(n)&&me(n)?ro&&(o=a);else t=i&&a?u:wr(t,r,3),qt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n) +});return o}function Xr(n,t){return Yr(n,Se(t))}function Gr(n,t,r,e){return(Tu(n)?Rt:lr)(n,wr(t,e,4),r,3>arguments.length,qt)}function Hr(n,t,r,e){return(Tu(n)?Ft:lr)(n,wr(t,e,4),r,3>arguments.length,Zt)}function Qr(n){n=Rr(n);for(var t=-1,r=n.length,e=Re(r);++targuments.length)return br([n,w,null,t]);var r=Lr(arguments,2),e=jr(r,re.placeholder);return ir(n,w|O,r,e,t)}function ee(n,t){var r=[t,w|j,null,n];if(2=r||r>t?(a&&He(a),r=p,a=s=p=_,r&&(h=Mu(),f=n.apply(c,i),s||a||(i=c=null))):s=iu(e,r) +}function u(){s&&He(s),a=s=p=_,(v||g!==t)&&(h=Mu(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=Mu(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(a&&(a=He(a)),h=l,f=n.apply(c,i)):a||(a=iu(u,o))}return d&&s?s=He(s):s||t===g||(s=iu(e,t)),r&&(d=true,f=n.apply(c,i)),!d||s||a||(i=c=null),f}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!ge(n))throw new $e(S);if(t=0>t?0:t,true===r)var y=true,v=false;else ve(r)&&(y=r.leading,g="maxWait"in r&&yu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v); +return o.cancel=function(){s&&He(s),a&&He(a),a=s=p=_},o}function ae(n){if(!ge(n))throw new $e(S);return function(){return!n.apply(this,arguments)}}function fe(n){var t=Lr(arguments,1),r=jr(t,fe.placeholder);return ir(n,O,t,r)}function le(n){var t=Lr(arguments,1),r=jr(t,le.placeholder);return ir(n,I,t,r)}function ce(n){return tr(n,_e)}function se(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ve.call(n)==rt||false}function pe(n){return n&&typeof n=="object"&&1===n.nodeType&&(Eu.nodeClass?-1t||null==n||!gu(t))return r;n=Pe(n);do t%2&&(r+=n),t=nu(t/2),n+=n; +while(t);return r}function Ae(n,t){return(n=null==n?"":Pe(n))?null==t?n.slice(v(n),y(n)+1):(t=Pe(t),n.slice(o(n,t),i(n,t)+1)):n}function xe(n){try{return n()}catch(t){return he(t)?t:Fe(t)}}function Ee(n,t){return Pt(n,t)}function Oe(n){return n}function Ie(n){var t=Nu(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Or(u))return function(n){return null!=n&&u===n[e]&&ru.call(n,e)}}for(var o=r,i=Re(r),a=Re(r);o--;){var u=n[t[o]],f=Or(u);i[o]=f,a[o]=f?u:$t(u,false)}return function(n){if(o=r,null==n)return!o; +for(;o--;)if(i[o]?a[o]!==n[t[o]]:!ru.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!ru.call(n,t[o]):!rr(a[o],n[t[o]],null,true))return false;return true}}function Ce(n,t,r){var e=true,u=t&&tr(t,Nu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=tr(t,Nu)),false===r?e=false:ve(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=ge(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},g.assign=Uu,g.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1t?0:t)},g.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Lr(n,0,0>t?0:t)},g.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=wr(t,r,3);e--&&t(n[e],e,n););return Lr(n,0,e+1)},g.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=wr(t,r,3);++e(p?e(p,f):i(s,f))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,f):i(n[t],f)))continue n}p&&p.push(f),s.push(f)}return s},g.invert=function(n,t){for(var r=-1,e=Nu(n),u=e.length,o={};++rt?0:t)},g.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Lr(n,0>t?0:t)},g.takeRightWhile=function(n,t,r){var e=n?n.length:0; +for(t=wr(t,r,3);e--&&t(n[e],e,n););return Lr(n,e+1)},g.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=wr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},g.escape=function(n){return n=null==n?"":Pe(n),P.lastIndex=0,P.test(n)?n.replace(P,s):n},g.escapeRegExp=we,g.every=zr,g.find=Zr,g.findIndex=kr,g.findKey=function(n,t,r){return t=wr(t,r,3),Yt(n,t,Qt,true)},g.findLast=function(n,t,r){return t=wr(t,r,3),Yt(n,t,Zt) +},g.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=wr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},g.findLastKey=function(n,t,r){return t=wr(t,r,3),Yt(n,t,nr,true)},g.findWhere=function(n,t){return Zr(n,Ie(t))},g.first=Fr,g.has=function(n,t){return n?ru.call(n,t):false},g.identity=Oe,g.indexOf=Ur,g.isArguments=se,g.isArray=Tu,g.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ve.call(n)==ut||false},g.isDate=function(n){return n&&typeof n=="object"&&Ve.call(n)==ot||false},g.isElement=pe,g.isEmpty=function(n){if(null==n)return true; +var t=n.length;return typeof t=="number"&&-1r?yu(u+r,0):du(r||0,u-1))+1;else if(r)return u=Nr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},g.max=Jr,g.min=function(n,t,r){var e=1/0,o=e,i=typeof t;"number"!=i&&"string"!=i||!r||r[t]!==n||(t=null);var i=null==t,a=!(i&&Tu(n))&&me(n);if(i&&!a)for(r=-1,n=Rr(n),i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},g.template=function(n,t,r){var e=g.templateSettings;t=Uu({},r||t,e,Wt),n=Pe(null==n?"":n),r=Uu({},t.imports,e.imports,Wt); +var u,o,i=Nu(r),a=be(r),f=0;r=t.interpolate||Y;var l="__p+='";if(r=Ne((t.escape||Y).source+"|"+r.source+"|"+(r===D?M:Y).source+"|"+(t.evaluate||Y).source+"|$","g"),n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(G,p),r&&(u=true,l+="'+__e("+r+")+'"),a&&(o=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(T,""):l).replace(L,"$1").replace(W,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=xe(function(){return Ue(i,"return "+l).apply(_,a) +}),t.source=l,he(t))throw t;return t},g.trim=Ae,g.trimLeft=function(n,t){return(n=null==n?"":Pe(n))?null==t?n.slice(v(n)):(t=Pe(t),n.slice(o(n,t))):n},g.trimRight=function(n,t){return(n=null==n?"":Pe(n))?null==t?n.slice(0,y(n)+1):(t=Pe(t),n.slice(0,i(n,t)+1)):n},g.trunc=function(n,t){var r=30,e="...";if(ve(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Pe(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Pe(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(de(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Ne(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Qt(g,function(n,t){var r="sample"!=t;g.prototype[t]||(g.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})}),g.VERSION=b,g.prototype.chain=function(){return this.__chain__=true,this},g.prototype.toJSON=Dr,g.prototype.toString=function(){return Pe(this.__wrapped__) +},g.prototype.value=Dr,g.prototype.valueOf=Dr,Ot(["join","pop","shift"],function(n){var t=Be[n];g.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),Ot(["push","reverse","sort","unshift"],function(n){var t=Be[n];g.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ot(["concat","splice"],function(n){var t=Be[n];g.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Eu.spliceObjects||Ot(["pop","shift","splice"],function(n){var t=Be[n],r="splice"==n; +g.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}}),g}var _,b="3.0.0-pre",w=1,j=2,A=4,x=8,E=16,O=32,I=64,C="__lodash@"+b+"__",S="Expected a function",R=Math.pow(2,32)-1,k=Math.pow(2,53)-1,F=0,U=/^[A-Z]+$/,T=/\b__p\+='';/g,L=/\b(__p\+=)''\+/g,W=/(__e\(.*?\)|\b__t\))\+'';/g,N=/&(?:amp|lt|gt|quot|#39|#96);/g,P=/[&<>"'`]/g,$=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,D=/<%=([\s\S]+?)%>/g,M=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,q=/^\s*function[ \n\r\t]+\w/,Z=/^0[xX]/,K=/^\[object .+?Constructor\]$/,V=/[\xC0-\xFF]/g,Y=/($^)/,J=/[.*+?^${}()|[\]\/\\]/g,X=/\bthis\b/,G=/['\n\r\u2028\u2029\\]/g,H=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,Q=" \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",nt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),tt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),rt="[object Arguments]",et="[object Array]",ut="[object Boolean]",ot="[object Date]",it="[object Error]",at="[object Function]",ft="[object Number]",lt="[object Object]",ct="[object RegExp]",st="[object String]",pt="[object ArrayBuffer]",ht="[object Float32Array]",gt="[object Float64Array]",vt="[object Int8Array]",yt="[object Int16Array]",dt="[object Int32Array]",mt="[object Uint8Array]",_t="[object Uint8ClampedArray]",bt="[object Uint16Array]",wt="[object Uint32Array]",jt={}; +jt[rt]=jt[et]=jt[ht]=jt[gt]=jt[vt]=jt[yt]=jt[dt]=jt[mt]=jt[_t]=jt[bt]=jt[wt]=true,jt[pt]=jt[ut]=jt[ot]=jt[it]=jt[at]=jt["[object Map]"]=jt[ft]=jt[lt]=jt[ct]=jt["[object Set]"]=jt[st]=jt["[object WeakMap]"]=false;var At={};At[rt]=At[et]=At[pt]=At[ut]=At[ot]=At[ht]=At[gt]=At[vt]=At[yt]=At[dt]=At[ft]=At[lt]=At[ct]=At[st]=At[mt]=At[_t]=At[bt]=At[wt]=true,At[it]=At[at]=At["[object Map]"]=At["[object Set]"]=At["[object WeakMap]"]=false;var xt={leading:false,maxWait:0,trailing:false},Et={configurable:false,enumerable:false,value:null,writable:false},Ot={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},It={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ct={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},St={"function":true,object:true},Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},kt=St[typeof window]&&window||this,Ft=St[typeof exports]&&exports&&!exports.nodeType&&exports,St=St[typeof module]&&module&&!module.nodeType&&module,Ut=Ft&&St&&typeof global=="object"&&global; +!Ut||Ut.global!==Ut&&Ut.window!==Ut&&Ut.self!==Ut||(kt=Ut);var Ut=St&&St.exports===Ft&&Ft,Tt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(kt._=Tt, define(function(){return Tt})):Ft&&St?Ut?(St.exports=Tt)._=Tt:Ft._=Tt:kt._=Tt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 6dd402453..8ff5d0b0d 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -70,7 +70,7 @@ /** Used to match `RegExp` flags from their coerced string values */ var reFlags = /\w*$/; - /** Used to detected named functions */ + /** Used to detect named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; /** Used to detect hexadecimal string values */ @@ -510,6 +510,19 @@ return '\\' + stringEscapes[chr]; } + /** + * Used by `_.trimmedLeftIndex` and `_.trimmedRightIndex` to determine if a + * character code is whitespace. + * + * @private + * @param {number} charCode The character code to inspect. + * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. + */ + function isWhitespace(charCode) { + return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || + (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); + } + /** * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace * character of `string`. @@ -522,13 +535,7 @@ var index = -1, length = string.length; - while (++index < length) { - var c = string.charCodeAt(index); - if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || - (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)))) { - break; - } - } + while (++index < length && isWhitespace(string.charCodeAt(index))) { } return index; } @@ -543,13 +550,7 @@ function trimmedRightIndex(string) { var index = string.length; - while (index--) { - var c = string.charCodeAt(index); - if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || - (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)))) { - break; - } - } + while (index-- && isWhitespace(string.charCodeAt(index))) { } return index; } @@ -697,14 +698,14 @@ * `chain`, `chunk`, `compact`, `compose`, `concat`, `constant`, `countBy`, * `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `keysIn`, `map`, `mapValues`, `matches`, `memoize`, `merge`, - * `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, - * `partition`, `pick`, `pluck`, `property`, `pull`, `pullAt`, `push`, `range`, - * `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, - * `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, - * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `flattenDeep`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `keysIn`, `map`, `mapValues`, `matches`, `memoize`, + * `merge`, `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, + * `partialRight`, `partition`, `pick`, `pluck`, `property`, `pull`, `pullAt`, + * `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, + * `sort`, `sortBy`, `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, * `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, * and `zipObject` * @@ -900,6 +901,26 @@ /*--------------------------------------------------------------------------*/ + /** + * Appends placeholder indexes to `array` adding `offset` to each appended index. + * + * @private + * @param {Array} array The array of placeholder indexes to append to. + * @param {Array} indexes The array of placeholder indexes to append. + * @param {number} offset The placeholder offset. + * @returns {Array} Returns `array`. + */ + function appendHolders(array, indexes, offset) { + var length = array.length, + index = indexes.length; + + array.length += index; + while (index--) { + array[length + index] = indexes[index] + offset; + } + return array; + } + /** * A specialized version of `_.forEach` for arrays without support for * callback shorthands or `this` binding. @@ -911,7 +932,7 @@ */ function arrayEach(array, iterator) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (iterator(array[index], index, array) === false) { @@ -931,7 +952,7 @@ * @returns {Array} Returns `array`. */ function arrayEachRight(array, iterator) { - var length = array ? array.length : 0; + var length = array.length; while (length--) { if (iterator(array[length], length, array) === false) { @@ -974,7 +995,7 @@ */ function arrayMap(array, iterator) { var index = -1, - length = array ? array.length : 0, + length = array.length, result = Array(length); while (++index < length) { @@ -1134,6 +1155,26 @@ return 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 = methodNames[index]; + object[key] = createWrapper([object[key], BIND_FLAG, null, object]); + } + return object; + } + /** * The base implementation of `_.callback` without support for creating * "_.pluck" and "_.where" style callbacks. @@ -1266,7 +1307,8 @@ case float32Class: case float64Class: case int8Class: case int16Class: case int32Class: case uint8Class: case uint8ClampedClass: case uint16Class: case uint32Class: - return new Ctor(cloneBuffer(value.buffer), value.byteOffset, value.length); + var buffer = value.buffer; + return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, value.byteOffset, value.length); case numberClass: case stringClass: @@ -1342,18 +1384,7 @@ * sets its metadata. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {number} data[1] The bitmask of flags to compose. See `createWrapper` - * for more details. - * @param {number} data[2] The arity of `data[0]`. - * @param {*} [data[3]] The `this` binding of `data[0]`. - * @param {Array} [data[4]] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [data[5]] An array of arguments to append to those - * provided to the new function. - * @param {Array} [data[6]] An array of `data[4]` placeholder indexes. - * @param {Array} [data[7]] An array of `data[5]` placeholder indexes. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new function. */ function baseCreateWrapper(data) { @@ -1361,7 +1392,7 @@ if (bitmask == BIND_FLAG) { return setData(createBindWrapper(data), data); } - var partialHolders = data[6]; + var partialHolders = data[5]; if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !partialHolders.length) { return setData(createPartialWrapper(data), data); } @@ -1369,7 +1400,7 @@ arity = data[2], thisArg = data[3], partialArgs = data[4], - partialRightArgs = data[5], + partialRightArgs = data[6], partialRightHolders = data[7]; var isBind = bitmask & BIND_FLAG, @@ -1396,7 +1427,9 @@ args = composeArgsRight(partialRightArgs, partialRightHolders, args); } if (isCurry || isCurryRight) { - var newPartialHolders = getHolders(args); + var placeholder = wrapper.placeholder, + newPartialHolders = getHolders(args, placeholder); + length -= newPartialHolders.length; if (length < arity) { @@ -1406,10 +1439,13 @@ if (!isCurryBound) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } - var newData = [func, bitmask, nativeMax(arity - length, 0), thisArg]; - newData[isCurry ? 4 : 5] = args; - newData[isCurry ? 6 : 7] = newPartialHolders; - return baseCreateWrapper(newData); + var newData = [func, bitmask, nativeMax(arity - length, 0), thisArg, null, null]; + newData[isCurry ? 4 : 6] = args; + newData[isCurry ? 5 : 7] = newPartialHolders; + + var result = baseCreateWrapper(newData); + result.placeholder = placeholder; + return result; } } var thisBinding = isBind ? thisArg : this; @@ -1436,7 +1472,7 @@ if (typeof arity != 'number') { arity = +arity || (func ? func.length : 0); } - return createWrapper(func, bitmask, arity); + return createWrapper([func, bitmask, arity]); } /** @@ -2059,15 +2095,19 @@ * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new partially applied function. */ - function basePartial(func, bitmask, args, thisArg) { + function basePartial(func, bitmask, args, holders, thisArg) { if (func) { var data = func[EXPANDO], arity = data ? data[2] : func.length; arity -= args.length; } - var isPartial = bitmask & PARTIAL_FLAG; - return createWrapper(func, bitmask, arity, thisArg, isPartial && args, !isPartial && args); + var isPartial = bitmask & PARTIAL_FLAG, + newData = [func, bitmask, arity, thisArg, null, null]; + + newData[isPartial ? 4 : 6] = args; + newData[isPartial ? 5 : 7] = holders; + return createWrapper(newData); } /** @@ -2424,9 +2464,7 @@ * with its associated `this` binding. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {*} data[3] The `this` binding of `data[0]`. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new bound function. */ function createBindWrapper(data) { @@ -2505,22 +2543,15 @@ * with its associated partially applied arguments and optional `this` binding. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {number} data[1] The bitmask of flags to compose. See `createWrapper` - * for more details. - * @param {*} [data[3]] The `this` binding of `data[0]`. - * @param {Array} data[4] An array of arguments to prepend to those - * provided to the new function. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new bound function. */ function createPartialWrapper(data) { var func = data[0], - bitmask = data[1], thisArg = data[3], partialArgs = data[4]; - var isBind = bitmask & BIND_FLAG, + var isBind = data[1] & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { @@ -2544,29 +2575,35 @@ } /** - * Creates a function that either curries or invokes `func` with an optional + * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of flags to compose. + * @param {Array} data The metadata array. + * @param {Function|string} data[0] The function or method name to reference. + * @param {number} data[1] The bitmask of flags to compose. * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curryRight` - * 16 - `_.curry` or `_.curryRight` of a bound function - * 32 - `_.partial` - * 64 - `_.partialRight` - * @param {number} [arity] The arity of `func`. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partialArgs] An array of arguments to prepend to those + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` + * 8 - `_.curryRight` + * 16 - `_.curry` or `_.curryRight` of a bound function + * 32 - `_.partial` + * 64 - `_.partialRight` + * @param {number} data[2] The arity of `data[0]`. + * @param {*} [data[3]] The `this` binding of `data[0]`. + * @param {Array} [data[4]] An array of arguments to prepend to those * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those + * @param {Array} [data[5]] An array of `data[4]` placeholder indexes. + * @param {Array} [data[6]] An array of arguments to append to those * provided to the new function. + * @param {Array} [data[7]] An array of `data[6]` placeholder indexes. * @returns {Function} Returns the new function. */ - function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs) { + function createWrapper(data) { + var func = data[0], + bitmask = data[1]; + var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isPartial = bitmask & PARTIAL_FLAG, @@ -2575,35 +2612,43 @@ if (!isBindKey && !isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } + var arity = data[2], + partialArgs = data[4], + partialRightArgs = data[6]; + if (isPartial && !partialArgs.length) { - bitmask &= ~PARTIAL_FLAG; - isPartial = partialArgs = false; + isPartial = false; + data[1] = (bitmask &= ~PARTIAL_FLAG); + data[4] = data[5] = partialArgs = null; } if (isPartialRight && !partialRightArgs.length) { - bitmask &= ~PARTIAL_RIGHT_FLAG; - isPartialRight = partialRightArgs = false; + isPartialRight = false; + data[1] = (bitmask &= ~PARTIAL_RIGHT_FLAG); + data[6] = data[7] = partialRightArgs = null; } - var data = !isBindKey && func[EXPANDO]; - if (data && data !== true) { - // shallow clone `data` - data = slice(data); + var funcData = !isBindKey && func[EXPANDO]; + if (funcData && funcData !== true) { + // shallow clone `funcData` + funcData = slice(funcData); // clone partial left arguments - if (data[4]) { - data[4] = slice(data[4]); + if (funcData[4]) { + funcData[4] = slice(funcData[4]); + funcData[5] = slice(funcData[5]); } // clone partial right arguments - if (data[5]) { - data[5] = slice(data[5]); + if (funcData[6]) { + funcData[6] = slice(funcData[6]); + funcData[7] = slice(funcData[7]); } // set arity if provided if (typeof arity == 'number') { - data[2] = arity; + funcData[2] = arity; } // set `thisArg` if not previously bound - var bound = data[1] & BIND_FLAG; + var bound = funcData[1] & BIND_FLAG; if (isBind && !bound) { - data[3] = thisArg; + funcData[3] = data[3]; } // set if currying a bound function if (!isBind && bound) { @@ -2611,35 +2656,39 @@ } // append partial left arguments if (isPartial) { - if (data[4]) { - push.apply(data[4], partialArgs); + var partialHolders = data[5], + funcPartialArgs = funcData[4]; + + if (funcPartialArgs) { + appendHolders(funcData[5], partialHolders, funcPartialArgs.length); + push.apply(funcPartialArgs, partialArgs); } else { - data[4] = partialArgs; + funcData[4] = partialArgs; + funcData[5] = partialHolders; } } // prepend partial right arguments if (isPartialRight) { - if (data[5]) { - unshift.apply(data[5], partialRightArgs); + var partialRightHolders = data[7], + funcPartialRightArgs = funcData[6]; + + if (funcPartialRightArgs) { + appendHolders(funcData[7], partialRightHolders, funcPartialRightArgs.length); + unshift.apply(funcPartialRightArgs, partialRightArgs); } else { - data[5] = partialRightArgs; + funcData[6] = partialRightArgs; + funcData[7] = partialRightHolders; } } // merge flags - data[1] |= bitmask; - return createWrapper.apply(undefined, data); - } - if (isPartial) { - var partialHolders = getHolders(partialArgs); - } - if (isPartialRight) { - var partialRightHolders = getHolders(partialRightArgs); + funcData[1] |= bitmask; + return createWrapper(funcData); } if (arity == null) { arity = isBindKey ? 0 : func.length; } - arity = nativeMax(arity, 0); - return baseCreateWrapper([func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]); + data[2] = nativeMax(arity, 0); + return baseCreateWrapper(data); } /** @@ -2664,13 +2713,13 @@ * @param {Array} array The array to inspect. * @returns {Array} Returns the new array of placeholder indexes. */ - function getHolders(array) { + function getHolders(array, placeholder) { var index = -1, length = array.length, result = []; while (++index < length) { - if (array[index] === lodash) { + if (array[index] === placeholder) { result.push(index); } } @@ -2864,8 +2913,8 @@ * Converts `collection` to an array if it is not an array-like value. * * @private - * @param {Array|Object|string} collection The collection to inspect. - * @returns {Array|Object} Returns the iterable object. + * @param {Array|Object|string} collection The collection to process. + * @returns {Array} Returns the iterable object. */ function toIterable(collection) { var length = collection ? collection.length : 0; @@ -3285,6 +3334,24 @@ return baseFlatten(array, isDeep); } + /** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2], [3, [[4]]]]); + * // => [1, 2, 3, 4]; + */ + function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true) : []; + } + /** * Gets the index at which the first occurrence of `value` is found in `array` * using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, @@ -5444,9 +5511,13 @@ * // => 'hi fred' */ function bind(func, thisArg) { - return arguments.length < 3 - ? createWrapper(func, BIND_FLAG, null, thisArg) - : basePartial(func, BIND_FLAG | PARTIAL_FLAG, slice(arguments, 2), thisArg); + if (arguments.length < 3) { + return createWrapper([func, BIND_FLAG, null, thisArg]); + } + var args = slice(arguments, 2), + partialHolders = getHolders(args, bind.placeholder); + + return basePartial(func, BIND_FLAG | PARTIAL_FLAG, args, partialHolders, thisArg); } /** @@ -5483,26 +5554,6 @@ ); } - /** - * 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 = methodNames[index]; - object[key] = createWrapper(object[key], BIND_FLAG, null, object); - } - return object; - } - /** * Creates a function that invokes the method at `object[key]` and prepends * any additional `bindKey` arguments to those provided to the bound function. @@ -5539,9 +5590,12 @@ * // => 'hiya fred!' */ function bindKey(object, key) { - return arguments.length < 3 - ? createWrapper(key, BIND_FLAG | BIND_KEY_FLAG, null, object) - : createWrapper(key, BIND_FLAG | BIND_KEY_FLAG | PARTIAL_FLAG, null, object, slice(arguments, 2)); + var data = [key, BIND_FLAG | BIND_KEY_FLAG, null, object]; + if (arguments.length > 2) { + var args = slice(arguments, 2); + data.push(args, getHolders(args, bindKey.placeholder)); + } + return createWrapper(data); } /** @@ -5629,7 +5683,9 @@ * // => [1, 2, 3] */ function curry(func, arity) { - return baseCurry(func, CURRY_FLAG, arity); + var result = baseCurry(func, CURRY_FLAG, arity); + result.placeholder = curry.placeholder; + return result; } /** @@ -5660,7 +5716,9 @@ * // => [1, 2, 3] */ function curryRight(func, arity) { - return baseCurry(func, CURRY_RIGHT_FLAG, arity); + var result = baseCurry(func, CURRY_RIGHT_FLAG, arity); + result.placeholder = curryRight.placeholder; + return result; } /** @@ -5675,6 +5733,9 @@ * the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * * @static * @memberOf _ * @category Function @@ -6006,7 +6067,10 @@ * // => 'hello fred' */ function partial(func) { - return basePartial(func, PARTIAL_FLAG, slice(arguments, 1)); + var args = slice(arguments, 1), + partialHolders = getHolders(args, partial.placeholder); + + return basePartial(func, PARTIAL_FLAG, args, partialHolders); } /** @@ -6041,7 +6105,10 @@ * // => { 'a': { 'b': { 'c': 1, 'd': 2 } } } */ function partialRight(func) { - return basePartial(func, PARTIAL_RIGHT_FLAG, slice(arguments, 1)); + var args = slice(arguments, 1), + partialHolders = getHolders(args, partialRight.placeholder); + + return basePartial(func, PARTIAL_RIGHT_FLAG, args, partialHolders); } /** @@ -6056,6 +6123,9 @@ * the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.throttle` and `_.debounce`. + * * @static * @memberOf _ * @category Function @@ -6095,7 +6165,6 @@ debounceOptions.leading = leading; debounceOptions.maxWait = +wait; debounceOptions.trailing = trailing; - return debounce(func, wait, debounceOptions); } @@ -6121,7 +6190,7 @@ * // => '

fred, barney, & pebbles

' */ function wrap(value, wrapper) { - return createWrapper(wrapper, PARTIAL_FLAG, null, null, [value]); + return basePartial(wrapper, PARTIAL_FLAG, [value], []); } /*--------------------------------------------------------------------------*/ @@ -7872,6 +7941,7 @@ * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. + * @param- {Object} [otherOptions] Enables the legacy `options` param signature. * @returns {Function} Returns the compiled template function. * @example * @@ -7939,13 +8009,13 @@ * };\ * '); */ - function template(string, options) { + function template(string, options, otherOptions) { // based on John Resig's `tmpl` implementation // http://ejohn.org/blog/javascript-micro-templating/ // and Laura Doktorova's doT.js // https://github.com/olado/doT var settings = lodash.templateSettings; - options = assign({}, options, settings, assignOwnDefaults); + options = assign({}, otherOptions || options, settings, assignOwnDefaults); string = String(string == null ? '' : string); var imports = assign({}, options.imports, settings.imports, assignOwnDefaults), @@ -8818,6 +8888,9 @@ // ensure `new lodashWrapper` is an instance of `lodash` lodashWrapper.prototype = lodash.prototype; + // assign default placeholders + bind.placeholder = bindKey.placeholder = curry.placeholder = curryRight.placeholder = partial.placeholder = partialRight.placeholder = lodash; + // add functions that return wrapped values when chaining lodash.after = after; lodash.assign = assign; @@ -8847,6 +8920,7 @@ lodash.dropWhile = dropWhile; lodash.filter = filter; lodash.flatten = flatten; + lodash.flattenDeep = flattenDeep; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index deb007571..c3417fbd8 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,66 +4,67 @@ * Build: `lodash modern -o ./dist/lodash.js` */ ;(function(){function n(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202i(t,a)&&c.push(a);return c}function Dt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>R)return Jt(n,t);for(var e=-1,u=Ir(n);++e=r||r>R)return Xt(n,t);for(var e=Ir(n);r--&&false!==t(e[r],r,n););return n}function zt(n,t){var r=true;return Dt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function qt(n,t){var r=[];return Dt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Pt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Zt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,f=r(n[i]);(e?f<=t:fo(l,s)&&((t||a)&&l.push(s),c.push(p))}return c}function cr(n,t){for(var r=-1,e=t(n),u=e.length,o=we(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?iu(u+e,0):e||0;else if(e)return e=Fr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Sr(n){return Cr(n,1)}function Cr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=iu(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=iu(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=we(u);++er?iu(e+r,0):r||0:0,typeof n=="string"||!ju(n)&&ce(n)?ro&&(o=f);else t=i&&f?u:dr(t,r,3),Dt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)});return o}function Kr(n,t){return Pr(n,be(t)) -}function Vr(n,t,r,e){return(ju(n)?It:or)(n,dr(t,e,4),r,3>arguments.length,Dt)}function Yr(n,t,r,e){return(ju(n)?kt:or)(n,dr(t,e,4),r,3>arguments.length,Mt)}function Jr(n){n=Ir(n);for(var t=-1,r=n.length,e=we(r);++t=r||r>t?(f&&ze(f),r=s,f=p=s=d,r&&(h=Su(),a=n.apply(l,i),p||f||(i=l=null))):p=Xe(e,r)}function u(){p&&ze(p),f=p=s=d,(v||g!==t)&&(h=Su(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Su(),l=this,s=v&&(p||!y),false===g)var r=y&&!p;else{f||y||(h=c);var o=g-(c-h),d=0>=o||o>g;d?(f&&(f=ze(f)),h=c,a=n.apply(l,i)):f||(f=Xe(u,o))}return d&&p?p=ze(p):p||t===g||(p=Xe(e,t)),r&&(d=true,a=n.apply(l,i)),!d||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;if(!oe(n))throw new Se(O);if(t=0>t?0:t,true===r)var y=true,v=false; -else ie(r)&&(y=r.leading,g="maxWait"in r&&iu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){p&&ze(p),f&&ze(f),f=p=s=d},o}function Qr(n){if(!oe(n))throw new Se(O);return function(){return!n.apply(this,arguments)}}function ne(n){return rr(n,x,Cr(arguments,1))}function te(n){return Gt(n,le)}function re(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Le.call(n)==Q||false}function ee(n){return n&&typeof n=="object"&&1===n.nodeType&&-1>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=we(r),f=0t||null==n||!uu(t))return r;n=Re(n);do t%2&&(r+=n),t=Pe(t/2),n+=n;while(t);return r}function ge(n,t){return(n=null==n?"":Re(n))?null==t?n.slice(h(n),g(n)+1):(t=Re(t),n.slice(o(n,t),i(n,t)+1)):n}function ve(n){try{return n()}catch(t){return ue(t)?t:Ae(t)}}function ye(n,t){return Ut(n,t) -}function de(n){return n}function me(n){var t=Eu(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(jr(u))return function(n){return null!=n&&u===n[e]&&Ke.call(n,e)}}for(var o=r,i=we(r),f=we(r);o--;){var u=n[t[o]],a=jr(u);i[o]=a,f[o]=a?u:Wt(u,false)}return function(n){if(o=r,null==n)return!o;for(;o--;)if(i[o]?f[o]!==n[t[o]]:!Ke.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!Ke.call(n,t[o]):!Ht(f[o],n[t[o]],null,true))return false;return true}}function _e(n,t,r){var e=true,u=t&&Gt(t,Eu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Gt(t,Eu)),false===r?e=false:ie(r)&&"chain"in r&&(e=r.chain),r=-1; -for(var o=oe(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},Z.assign=wu,Z.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1arguments.length?yr(n,_,null,t):rr(n,_|x,Cr(arguments,2),t)},Z.bindAll=function(n){for(var t=n,r=1arguments.length?yr(t,_|b,null,n):yr(t,_|b|x,null,n,Cr(arguments,2))},Z.callback=ye,Z.chain=function(n){return n=Z(n),n.__chain__=true,n},Z.chunk=function(n,t){var r=0,e=n?n.length:0,u=[];for(t=iu(+t||1,1);rt?0:t)},Z.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Cr(n,0,0>t?0:t)},Z.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=dr(t,r,3);e--&&t(n[e],e,n););return Cr(n,0,e+1) -},Z.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=dr(t,r,3);++e(s?e(s,a):i(p,a))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,a):i(n[t],a)))continue n -}s&&s.push(a),p.push(a)}return p},Z.invert=function(n,t){for(var r=-1,e=Eu(n),u=e.length,o={};++rt?0:t)},Z.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Cr(n,0>t?0:t)},Z.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=dr(t,r,3);e--&&t(n[e],e,n););return Cr(n,e+1)},Z.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=dr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Z.escape=function(n){return n=null==n?"":Re(n),N.lastIndex=0,N.test(n)?n.replace(N,p):n -},Z.escapeRegExp=se,Z.every=Br,Z.find=Mr,Z.findIndex=Or,Z.findKey=function(n,t,r){return t=dr(t,r,3),Pt(n,t,Jt,true)},Z.findLast=function(n,t,r){return t=dr(t,r,3),Pt(n,t,Mt)},Z.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=dr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Z.findLastKey=function(n,t,r){return t=dr(t,r,3),Pt(n,t,Xt,true)},Z.findWhere=function(n,t){return Mr(n,me(t))},Z.first=kr,Z.has=function(n,t){return n?Ke.call(n,t):false},Z.identity=de,Z.indexOf=Rr,Z.isArguments=re,Z.isArray=ju,Z.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Le.call(n)==tt||false -},Z.isDate=function(n){return n&&typeof n=="object"&&Le.call(n)==rt||false},Z.isElement=ee,Z.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?iu(u+r,0):fu(r||0,u-1))+1;else if(r)return u=Tr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},Z.max=Zr,Z.min=function(n,t,r){var e=1/0,o=e,i=typeof t;"number"!=i&&"string"!=i||!r||r[t]!==n||(t=null);var i=null==t,f=!(i&&ju(n))&&ce(n);if(i&&!f)for(r=-1,n=Ir(n),i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Z.template=function(n,t){var r=Z.templateSettings;t=wu({},t,r,Ft),n=Re(null==n?"":n); -var e,u,r=wu({},t.imports,r.imports,Ft),o=Eu(r),i=pe(r),f=0,r=t.interpolate||K,a="__p+='",r=ke((t.escape||K).source+"|"+r.source+"|"+(r===B?D:K).source+"|"+(t.evaluate||K).source+"|$","g");if(n.replace(r,function(t,r,o,i,c,l){return o||(o=i),a+=n.slice(f,l).replace(J,s),r&&(e=true,a+="'+__e("+r+")+'"),c&&(u=true,a+="';"+c+";\n__p+='"),o&&(a+="'+((__t=("+o+"))==null?'':__t)+'"),f=l+t.length,t}),a+="';",(r=t.variable)||(a="with(obj){"+a+"}"),a=(u?a.replace(F,""):a).replace(T,"$1").replace(U,"$1;"),a="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(e?",__e=_.escape":"")+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",r=ve(function(){return xe(o,"return "+a).apply(d,i) -}),r.source=a,ue(r))throw r;return r},Z.trim=ge,Z.trimLeft=function(n,t){return(n=null==n?"":Re(n))?null==t?n.slice(h(n)):(t=Re(t),n.slice(o(n,t))):n},Z.trimRight=function(n,t){return(n=null==n?"":Re(n))?null==t?n.slice(0,g(n)+1):(t=Re(t),n.slice(0,i(n,t)+1)):n},Z.trunc=function(n,t){var r=30,e="...";if(ie(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Re(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Re(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e; -if(r=n.slice(0,o),null==u)return r+e;if(ae(u)){if(n.slice(o).search(u)){var i,f,a=n.slice(0,o);for(u.global||(u=ke(u.source,(M.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(a);)f=i.index;r=r.slice(0,null==f?o:f)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Jt(Z,function(n,t){var r="sample"!=t;Z.prototype[t]||(Z.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new X(o,u):o})}),Z.VERSION=m,Z.prototype.chain=function(){return this.__chain__=true,this},Z.prototype.toJSON=Lr,Z.prototype.toString=function(){return Re(this.__wrapped__) -},Z.prototype.value=Lr,Z.prototype.valueOf=Lr,jt(["join","pop","shift"],function(n){var t=Ce[n];Z.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new X(r,n):r}}),jt(["push","reverse","sort","unshift"],function(n){var t=Ce[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),jt(["concat","splice"],function(n){var t=Ce[n];Z.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Z}var d,m="3.0.0-pre",_=1,b=2,w=4,j=8,A=16,x=32,E=64,I="__lodash@"+m+"__",O="Expected a function",k=Math.pow(2,32)-1,R=Math.pow(2,53)-1,S=0,C=/^[A-Z]+$/,F=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,U=/(__e\(.*?\)|\b__t\))\+'';/g,W=/&(?:amp|lt|gt|quot|#39|#96);/g,N=/[&<>"'`]/g,L=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/\w*$/,z=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,P=/^\[object .+?Constructor\]$/,Z=/[\xC0-\xFF]/g,K=/($^)/,V=/[.*+?^${}()|[\]\/\\]/g,Y=/\bthis\b/,J=/['\n\r\u2028\u2029\\]/g,X=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,G=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",H="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),Q="[object Arguments]",nt="[object Array]",tt="[object Boolean]",rt="[object Date]",et="[object Error]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",ft="[object String]",at="[object ArrayBuffer]",ct="[object Float32Array]",lt="[object Float64Array]",pt="[object Int8Array]",st="[object Int16Array]",ht="[object Int32Array]",gt="[object Uint8Array]",vt="[object Uint8ClampedArray]",yt="[object Uint16Array]",dt="[object Uint32Array]",mt={}; -mt[Q]=mt[nt]=mt[ct]=mt[lt]=mt[pt]=mt[st]=mt[ht]=mt[gt]=mt[vt]=mt[yt]=mt[dt]=true,mt[at]=mt[tt]=mt[rt]=mt[et]=mt["[object Function]"]=mt["[object Map]"]=mt[ut]=mt[ot]=mt[it]=mt["[object Set]"]=mt[ft]=mt["[object WeakMap]"]=false;var _t={};_t[Q]=_t[nt]=_t[at]=_t[tt]=_t[rt]=_t[ct]=_t[lt]=_t[pt]=_t[st]=_t[ht]=_t[ut]=_t[ot]=_t[it]=_t[ft]=_t[gt]=_t[vt]=_t[yt]=_t[dt]=true,_t[et]=_t["[object Function]"]=_t["[object Map]"]=_t["[object Set]"]=_t["[object WeakMap]"]=false;var bt={leading:false,maxWait:0,trailing:false},wt={configurable:false,enumerable:false,value:null,writable:false},jt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},At={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},xt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},Et={"function":true,object:true},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ot=Et[typeof window]&&window||this,kt=Et[typeof exports]&&exports&&!exports.nodeType&&exports,Et=Et[typeof module]&&module&&!module.nodeType&&module,Rt=kt&&Et&&typeof global=="object"&&global; -!Rt||Rt.global!==Rt&&Rt.window!==Rt&&Rt.self!==Rt||(Ot=Rt);var Rt=Et&&Et.exports===kt&&kt,St=y();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ot._=St, define(function(){return St})):kt&&Et?Rt?(Et.exports=St)._=St:kt._=St:Ot._=St}).call(this); \ No newline at end of file +}function f(n,r){return t(n.a,r.a)||n.b-r.b}function a(n,r){for(var e=-1,u=n.a,o=r.a,i=u.length;++e=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n) +}function g(n){for(var t=-1,r=n.length;++ti(t,a)&&c.push(a);return c}function Mt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>S)return Xt(n,t);for(var e=-1,u=Or(n);++e=r||r>S)return Gt(n,t);for(var e=Or(n);r--&&false!==t(e[r],r,n););return n}function qt(n,t){var r=true;return Mt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Pt(n,t){var r=[];return Mt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Zt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Kt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++e>>1,f=r(n[i]); +(e?f<=t:fo(l,s)&&((t||a)&&l.push(s),c.push(p))}return c}function lr(n,t){for(var r=-1,e=t(n),u=e.length,o=Oe(u);++re)return t;var u=typeof r[2];if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3e?su(u+e,0):e||0;else if(e)return e=Tr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Cr(n){return Fr(n,1)}function Fr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t?t=su(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=su(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Oe(u);++er?su(e+r,0):r||0:0,typeof n=="string"||!Ru(n)&&ve(n)?ro&&(o=f);else t=i&&f?u:mr(t,r,3),Mt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)});return o}function Vr(n,t){return Zr(n,Ie(t)) +}function Yr(n,t,r,e){return(Ru(n)?Ot:ir)(n,mr(t,e,4),r,3>arguments.length,Mt)}function Jr(n,t,r,e){return(Ru(n)?kt:ir)(n,mr(t,e,4),r,3>arguments.length,zt)}function Xr(n){n=Or(n);for(var t=-1,r=n.length,e=Oe(r);++targuments.length)return dr([n,b,null,t]); +var r=Fr(arguments,2),e=_r(r,Qr.placeholder);return er(n,b|E,r,e,t)}function ne(n,t){var r=[t,b|w,null,n];if(2=r||r>t?(f&&Ye(f),r=s,f=p=s=m,r&&(h=Nu(),a=n.apply(l,i),p||f||(i=l=null))):p=ru(e,r)}function u(){p&&Ye(p),f=p=s=m,(v||g!==t)&&(h=Nu(),a=n.apply(l,i),p||f||(i=l=null)) +}function o(){if(i=arguments,c=Nu(),l=this,s=v&&(p||!y),false===g)var r=y&&!p;else{f||y||(h=c);var o=g-(c-h),d=0>=o||o>g;d?(f&&(f=Ye(f)),h=c,a=n.apply(l,i)):f||(f=ru(u,o))}return d&&p?p=Ye(p):p||t===g||(p=ru(e,t)),r&&(d=true,a=n.apply(l,i)),!d||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;if(!pe(n))throw new Ne(R);if(t=0>t?0:t,true===r)var y=true,v=false;else se(r)&&(y=r.leading,g="maxWait"in r&&su(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){p&&Ye(p),f&&Ye(f),f=p=s=m},o}function ue(n){if(!pe(n))throw new Ne(R); +return function(){return!n.apply(this,arguments)}}function oe(n){var t=Fr(arguments,1),r=_r(t,oe.placeholder);return er(n,E,t,r)}function ie(n){var t=Fr(arguments,1),r=_r(t,ie.placeholder);return er(n,I,t,r)}function fe(n){return Ht(n,ye)}function ae(n){return n&&typeof n=="object"&&typeof n.length=="number"&&qe.call(n)==nt||false}function ce(n){return n&&typeof n=="object"&&1===n.nodeType&&-1>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=Oe(r),f=0t||null==n||!lu(t))return r;n=We(n);do t%2&&(r+=n),t=Xe(t/2),n+=n;while(t);return r}function be(n,t){return(n=null==n?"":We(n))?null==t?n.slice(g(n),v(n)+1):(t=We(t),n.slice(o(n,t),i(n,t)+1)):n}function we(n){try{return n()}catch(t){return le(t)?t:ke(t)}}function je(n,t){return Wt(n,t) +}function Ae(n){return n}function xe(n){var t=Cu(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Ar(u))return function(n){return null!=n&&u===n[e]&&He.call(n,e)}}for(var o=r,i=Oe(r),f=Oe(r);o--;){var u=n[t[o]],a=Ar(u);i[o]=a,f[o]=a?u:Nt(u,false)}return function(n){if(o=r,null==n)return!o;for(;o--;)if(i[o]?f[o]!==n[t[o]]:!He.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!He.call(n,t[o]):!Qt(f[o],n[t[o]],null,true))return false;return true}}function Ee(n,t,r){var e=true,u=t&&Ht(t,Cu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Ht(t,Cu)),false===r?e=false:se(r)&&"chain"in r&&(e=r.chain),r=-1; +for(var o=pe(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},h.assign=Ou,h.at=function(t){var r=t?t.length:0;return typeof r=="number"&&-1t?0:t)},h.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Fr(n,0,0>t?0:t)},h.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=mr(t,r,3);e--&&t(n[e],e,n););return Fr(n,0,e+1)},h.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=mr(t,r,3);++e(s?e(s,a):i(p,a))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,a):i(n[t],a)))continue n}s&&s.push(a),p.push(a)}return p},h.invert=function(n,t){for(var r=-1,e=Cu(n),u=e.length,o={};++rt?0:t)},h.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((null==t||r?1:t)||0),Fr(n,0>t?0:t)},h.takeRightWhile=function(n,t,r){var e=n?n.length:0; +for(t=mr(t,r,3);e--&&t(n[e],e,n););return Fr(n,e+1)},h.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=mr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},h.escape=function(n){return n=null==n?"":We(n),L.lastIndex=0,L.test(n)?n.replace(L,p):n},h.escapeRegExp=me,h.every=Dr,h.find=zr,h.findIndex=Rr,h.findKey=function(n,t,r){return t=mr(t,r,3),Zt(n,t,Xt,true)},h.findLast=function(n,t,r){return t=mr(t,r,3),Zt(n,t,zt) +},h.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=mr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},h.findLastKey=function(n,t,r){return t=mr(t,r,3),Zt(n,t,Gt,true)},h.findWhere=function(n,t){return zr(n,xe(t))},h.first=kr,h.has=function(n,t){return n?He.call(n,t):false},h.identity=Ae,h.indexOf=Sr,h.isArguments=ae,h.isArray=Ru,h.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&qe.call(n)==rt||false},h.isDate=function(n){return n&&typeof n=="object"&&qe.call(n)==et||false},h.isElement=ce,h.isEmpty=function(n){if(null==n)return true; +var t=n.length;return typeof t=="number"&&-1r?su(u+r,0):hu(r||0,u-1))+1;else if(r)return u=Ur(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},h.max=Kr,h.min=function(n,t,r){var e=1/0,o=e,i=typeof t;"number"!=i&&"string"!=i||!r||r[t]!==n||(t=null);var i=null==t,f=!(i&&Ru(n))&&ve(n);if(i&&!f)for(r=-1,n=Or(n),i=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},h.template=function(n,t,r){var e=h.templateSettings;t=Ou({},r||t,e,Tt),n=We(null==n?"":n),r=Ou({},t.imports,e.imports,Tt); +var u,o,i=Cu(r),f=de(r),a=0;r=t.interpolate||V;var c="__p+='";if(r=Ue((t.escape||V).source+"|"+r.source+"|"+(r===D?M:V).source+"|"+(t.evaluate||V).source+"|$","g"),n.replace(r,function(t,r,e,i,f,l){return e||(e=i),c+=n.slice(a,l).replace(X,s),r&&(u=true,c+="'+__e("+r+")+'"),f&&(o=true,c+="';"+f+";\n__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),a=l+t.length,t}),c+="';",(t=t.variable)||(c="with(obj){"+c+"}"),c=(o?c.replace(T,""):c).replace(U,"$1").replace(W,"$1;"),c="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}",t=we(function(){return Se(i,"return "+c).apply(m,f) +}),t.source=c,le(t))throw t;return t},h.trim=be,h.trimLeft=function(n,t){return(n=null==n?"":We(n))?null==t?n.slice(g(n)):(t=We(t),n.slice(o(n,t))):n},h.trimRight=function(n,t){return(n=null==n?"":We(n))?null==t?n.slice(0,v(n)+1):(t=We(t),n.slice(0,i(n,t)+1)):n},h.trunc=function(n,t){var r=30,e="...";if(se(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?We(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":We(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(ge(u)){if(n.slice(o).search(u)){var i,f,a=n.slice(0,o);for(u.global||(u=Ue(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(a);)f=i.index;r=r.slice(0,null==f?o:f)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Xt(h,function(n,t){var r="sample"!=t;h.prototype[t]||(h.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 K(o,u):o})}),h.VERSION=_,h.prototype.chain=function(){return this.__chain__=true,this},h.prototype.toJSON=$r,h.prototype.toString=function(){return We(this.__wrapped__) +},h.prototype.value=$r,h.prototype.valueOf=$r,At(["join","pop","shift"],function(n){var t=Le[n];h.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new K(r,n):r}}),At(["push","reverse","sort","unshift"],function(n){var t=Le[n];h.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),At(["concat","splice"],function(n){var t=Le[n];h.prototype[n]=function(){return new K(t.apply(this.__wrapped__,arguments),this.__chain__)}}),h}var m,_="3.0.0-pre",b=1,w=2,j=4,A=8,x=16,E=32,I=64,O="__lodash@"+_+"__",R="Expected a function",k=Math.pow(2,32)-1,S=Math.pow(2,53)-1,C=0,F=/^[A-Z]+$/,T=/\b__p\+='';/g,U=/\b(__p\+=)''\+/g,W=/(__e\(.*?\)|\b__t\))\+'';/g,N=/&(?:amp|lt|gt|quot|#39|#96);/g,L=/[&<>"'`]/g,$=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,D=/<%=([\s\S]+?)%>/g,M=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,q=/^\s*function[ \n\r\t]+\w/,P=/^0[xX]/,Z=/^\[object .+?Constructor\]$/,K=/[\xC0-\xFF]/g,V=/($^)/,Y=/[.*+?^${}()|[\]\/\\]/g,J=/\bthis\b/,X=/['\n\r\u2028\u2029\\]/g,G=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,H=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Q="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array window WinRTError".split(" "),nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Error]",ot="[object Number]",it="[object Object]",ft="[object RegExp]",at="[object String]",ct="[object ArrayBuffer]",lt="[object Float32Array]",pt="[object Float64Array]",st="[object Int8Array]",ht="[object Int16Array]",gt="[object Int32Array]",vt="[object Uint8Array]",yt="[object Uint8ClampedArray]",dt="[object Uint16Array]",mt="[object Uint32Array]",_t={}; +_t[nt]=_t[tt]=_t[lt]=_t[pt]=_t[st]=_t[ht]=_t[gt]=_t[vt]=_t[yt]=_t[dt]=_t[mt]=true,_t[ct]=_t[rt]=_t[et]=_t[ut]=_t["[object Function]"]=_t["[object Map]"]=_t[ot]=_t[it]=_t[ft]=_t["[object Set]"]=_t[at]=_t["[object WeakMap]"]=false;var bt={};bt[nt]=bt[tt]=bt[ct]=bt[rt]=bt[et]=bt[lt]=bt[pt]=bt[st]=bt[ht]=bt[gt]=bt[ot]=bt[it]=bt[ft]=bt[at]=bt[vt]=bt[yt]=bt[dt]=bt[mt]=true,bt[ut]=bt["[object Function]"]=bt["[object Map]"]=bt["[object Set]"]=bt["[object WeakMap]"]=false;var wt={leading:false,maxWait:0,trailing:false},jt={configurable:false,enumerable:false,value:null,writable:false},At={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},xt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Et={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},It={"function":true,object:true},Ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Rt=It[typeof window]&&window||this,kt=It[typeof exports]&&exports&&!exports.nodeType&&exports,It=It[typeof module]&&module&&!module.nodeType&&module,St=kt&&It&&typeof global=="object"&&global; +!St||St.global!==St&&St.window!==St&&St.self!==St||(Rt=St);var St=It&&It.exports===kt&&kt,Ct=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Rt._=Ct, define(function(){return Ct})):kt&&It?St?(It.exports=Ct)._=Ct:kt._=Ct:Rt._=Ct}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index e4b0cc546..9ec0d3894 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -327,14 +327,14 @@ * `chain`, `chunk`, `compact`, `compose`, `concat`, `constant`, `countBy`, * `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `keysIn`, `map`, `mapValues`, `matches`, `memoize`, `merge`, - * `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, - * `partition`, `pick`, `pluck`, `property`, `pull`, `pullAt`, `push`, `range`, - * `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, - * `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, - * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `flattenDeep`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `keysIn`, `map`, `mapValues`, `matches`, `memoize`, + * `merge`, `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, + * `partialRight`, `partition`, `pick`, `pluck`, `property`, `pull`, `pullAt`, + * `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, + * `sort`, `sortBy`, `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, * `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, * and `zipObject` * @@ -484,7 +484,7 @@ */ function arrayEach(array, iterator) { var index = -1, - length = array ? array.length : 0; + length = array.length; while (++index < length) { if (iterator(array[index], index, array) === breakIndicator) { @@ -527,7 +527,7 @@ */ function arrayMap(array, iterator) { var index = -1, - length = array ? array.length : 0, + length = array.length, result = Array(length); while (++index < length) { @@ -630,6 +630,26 @@ return false; } + /** + * 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 = methodNames[index]; + object[key] = createWrapper([object[key], BIND_FLAG, null, object]); + } + return object; + } + /** * The base implementation of `_.callback` without support for creating * "_.pluck" and "_.where" style callbacks. @@ -703,18 +723,7 @@ * sets its metadata. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {number} data[1] The bitmask of flags to compose. See `createWrapper` - * for more details. - * @param {number} data[2] The arity of `data[0]`. - * @param {*} [data[3]] The `this` binding of `data[0]`. - * @param {Array} [data[4]] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [data[5]] An array of arguments to append to those - * provided to the new function. - * @param {Array} [data[6]] An array of `data[4]` placeholder indexes. - * @param {Array} [data[7]] An array of `data[5]` placeholder indexes. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new function. */ function baseCreateWrapper(data) { @@ -722,7 +731,7 @@ if (bitmask == BIND_FLAG) { return createBindWrapper(data); } - var partialHolders = data[6]; + var partialHolders = data[5]; if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !partialHolders.length) { return createPartialWrapper(data); } @@ -730,7 +739,7 @@ arity = data[2], thisArg = data[3], partialArgs = data[4], - partialRightArgs = data[5]; + partialRightArgs = data[6]; var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, @@ -1227,9 +1236,19 @@ * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new partially applied function. */ - function basePartial(func, bitmask, args, thisArg) { - var isPartial = bitmask & PARTIAL_FLAG; - return createWrapper(func, bitmask, null, thisArg, isPartial && args, !isPartial && args); + function basePartial(func, bitmask, args, holders, thisArg) { + if (func) { + var data = func[EXPANDO], + arity = data ? data[2] : func.length; + + arity -= args.length; + } + var isPartial = bitmask & PARTIAL_FLAG, + newData = [func, bitmask, arity, thisArg, null, null]; + + newData[isPartial ? 4 : 6] = args; + newData[isPartial ? 5 : 7] = holders; + return createWrapper(newData); } /** @@ -1474,9 +1493,7 @@ * with its associated `this` binding. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {*} data[3] The `this` binding of `data[0]`. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new bound function. */ function createBindWrapper(data) { @@ -1514,22 +1531,15 @@ * with its associated partially applied arguments and optional `this` binding. * * @private - * @param {Array} data The metadata array. - * @param {Function|string} data[0] The function or method name to reference. - * @param {number} data[1] The bitmask of flags to compose. See `createWrapper` - * for more details. - * @param {*} [data[3]] The `this` binding of `data[0]`. - * @param {Array} data[4] An array of arguments to prepend to those - * provided to the new function. + * @param {Array} data The metadata array. See `createWrapper` for more details. * @returns {Function} Returns the new bound function. */ function createPartialWrapper(data) { var func = data[0], - bitmask = data[1], thisArg = data[3], partialArgs = data[4]; - var isBind = bitmask & BIND_FLAG, + var isBind = data[1] & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { @@ -1553,29 +1563,35 @@ } /** - * Creates a function that either curries or invokes `func` with an optional + * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of flags to compose. + * @param {Array} data The metadata array. + * @param {Function|string} data[0] The function or method name to reference. + * @param {number} data[1] The bitmask of flags to compose. * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curryRight` - * 16 - `_.curry` or `_.curryRight` of a bound function - * 32 - `_.partial` - * 64 - `_.partialRight` - * @param {number} [arity] The arity of `func`. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partialArgs] An array of arguments to prepend to those + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` + * 8 - `_.curryRight` + * 16 - `_.curry` or `_.curryRight` of a bound function + * 32 - `_.partial` + * 64 - `_.partialRight` + * @param {number} data[2] The arity of `data[0]`. + * @param {*} [data[3]] The `this` binding of `data[0]`. + * @param {Array} [data[4]] An array of arguments to prepend to those * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those + * @param {Array} [data[5]] An array of `data[4]` placeholder indexes. + * @param {Array} [data[6]] An array of arguments to append to those * provided to the new function. + * @param {Array} [data[7]] An array of `data[6]` placeholder indexes. * @returns {Function} Returns the new function. */ - function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs) { + function createWrapper(data) { + var func = data[0], + bitmask = data[1]; + var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isPartial = bitmask & PARTIAL_FLAG, @@ -1584,18 +1600,20 @@ if (!isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } + var arity = data[2], + partialArgs = data[4], + partialRightArgs = data[6]; + if (isPartial && !partialArgs.length) { - bitmask &= ~PARTIAL_FLAG; - isPartial = partialArgs = false; - } - if (isPartial) { - var partialHolders = getHolders(partialArgs); + isPartial = false; + data[1] = (bitmask &= ~PARTIAL_FLAG); + data[4] = data[5] = partialArgs = null; } if (arity == null) { arity = isBindKey ? 0 : func.length; } - arity = nativeMax(arity, 0); - return baseCreateWrapper([func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders]); + data[2] = nativeMax(arity, 0); + return baseCreateWrapper(data); } /** @@ -1605,13 +1623,13 @@ * @param {Array} array The array to inspect. * @returns {Array} Returns the new array of placeholder indexes. */ - function getHolders(array) { + function getHolders(array, placeholder) { var index = -1, length = array.length, result = []; while (++index < length) { - if (array[index] === lodash) { + if (array[index] === placeholder) { result.push(index); } } @@ -1701,8 +1719,8 @@ * Converts `collection` to an array if it is not an array-like value. * * @private - * @param {Array|Object|string} collection The collection to inspect. - * @returns {Array|Object} Returns the iterable object. + * @param {Array|Object|string} collection The collection to process. + * @returns {Array} Returns the iterable object. */ function toIterable(collection) { var length = collection ? collection.length : 0; @@ -3635,8 +3653,8 @@ */ function bind(func, thisArg) { return arguments.length < 3 - ? createWrapper(func, BIND_FLAG, null, thisArg) - : basePartial(func, BIND_FLAG | PARTIAL_FLAG, slice(arguments, 2), thisArg); + ? createWrapper([func, BIND_FLAG, null, thisArg]) + : basePartial(func, BIND_FLAG | PARTIAL_FLAG, slice(arguments, 2), [], thisArg); } /** @@ -3673,26 +3691,6 @@ ); } - /** - * 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 = methodNames[index]; - object[key] = createWrapper(object[key], BIND_FLAG, null, object); - } - return object; - } - /** * Creates a function that is the composition of the provided functions, * where each function consumes the return value of the function that follows. @@ -3759,6 +3757,9 @@ * the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * * @static * @memberOf _ * @category Function @@ -4088,7 +4089,10 @@ * // => 'hello fred' */ function partial(func) { - return basePartial(func, PARTIAL_FLAG, slice(arguments, 1)); + var args = slice(arguments, 1), + partialHolders = getHolders(args, partial.placeholder); + + return basePartial(func, PARTIAL_FLAG, args, partialHolders); } /** @@ -4103,6 +4107,9 @@ * the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.throttle` and `_.debounce`. + * * @static * @memberOf _ * @category Function @@ -4168,7 +4175,7 @@ * // => '

fred, barney, & pebbles

' */ function wrap(value, wrapper) { - return createWrapper(wrapper, PARTIAL_FLAG, null, null, [value]); + return basePartial(wrapper, PARTIAL_FLAG, [value], []); } /*--------------------------------------------------------------------------*/ @@ -5093,6 +5100,7 @@ * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. + * @param- {Object} [otherOptions] Enables the legacy `options` param signature. * @returns {Function} Returns the compiled template function. * @example * @@ -5677,6 +5685,9 @@ // ensure `new lodashWrapper` is an instance of `lodash` lodashWrapper.prototype = lodash.prototype; + // assign default placeholders + bind.placeholder = partial.placeholder = lodash; + // add functions that return wrapped values when chaining lodash.after = after; lodash.bind = bind; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index d7e8bef5d..98f796e74 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,43 +3,43 @@ * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash underscore -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(tu(r,i)&&o.push(i)}return o}function b(n,r){var t=n?n.length:0; -if(typeof t!="number"||-1>=t||t>$r)return x(n,r,Nt);for(var e=-1,u=P(n);++e=t||t>$r){for(var t=Nt(n),e=t.length;e--;){var u=t[e];if(r(n[u],u,n)===Mr)break}return n}for(e=P(n);t--&&r(e[t],t,n)!==Mr;);return n}function d(n,r){var t=true;return b(n,function(n,e,u){return(t=!!r(n,e,u))||Mr}),t}function j(n,r){var t=[];return b(n,function(n,e,u){r(n,e,u)&&t.push(n)}),t}function w(n,r,t){var e;return t(n,function(n,t,u){return r(n,t,u)?(e=n,Mr):void 0 -}),e}function A(n,r,t,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++ee(i,a)&&(r&&i.push(a),o.push(f)) -}return o}function $(n,r){return function(t,e,u){var o=r?r():{};if(e=h(e,u,3),$t(t)){u=-1;for(var i=t.length;++ur?0:r)}function G(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?At(u+e,0):e||0;else if(e)return e=K(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function H(n,r,t){return J(n,null==r||t?1:0>r?0:r)}function J(n,r,t){var e=-1,u=n?n.length:0;for(r=null==r?0:+r||0,0>r?r=At(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=At(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1;t(n[o])u&&(u=i)}else r=h(r,t,3),b(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function er(n,r){return rr(n,Or(r))}function ur(n,r,t,e){return($t(n)?p:M)(n,h(r,e,4),t,3>arguments.length,b)}function or(n,r,t,e){return($t(n)?s:M)(n,h(r,e,4),t,3>arguments.length,_)}function ir(n){n=P(n);for(var r=-1,t=n.length,e=Array(t);++r=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=kr,t&&(g=Rt(),a=n.apply(l,i),p||f||(i=l=null))):p=setTimeout(e,t)}function u(){p&&clearTimeout(p),f=p=s=kr,(v||h!==r)&&(g=Rt(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Rt(),l=this,s=v&&(p||!y),false===h)var t=y&&!p;else{f||y||(g=c);var o=h-(c-g),m=0>=o||o>h;m?(f&&(f=clearTimeout(f)),g=c,a=n.apply(l,i)):f||(f=setTimeout(u,o)) -}return m&&p?p=clearTimeout(p):p||r===h||(p=setTimeout(e,r)),t&&(m=true,a=n.apply(l,i)),!m||p||f||(i=l=null),a}var i,f,a,c,l,p,s,g=0,h=false,v=true;if(!yr(n))throw new TypeError(qr);if(r=0>r?0:r,true===t)var y=true,v=false;else mr(t)&&(y=t.leading,h="maxWait"in t&&At(+t.maxWait||0,r),v="trailing"in t?t.trailing:v);return o.cancel=function(){p&&clearTimeout(p),f&&clearTimeout(f),f=p=s=kr},o}function cr(n){if(!yr(n))throw new TypeError(qr);return function(){return!n.apply(this,arguments)}}function lr(n){return S(n,Fr,J(arguments,1)) -}function pr(n){if(null==n)return n;var r=arguments,t=0,e=r.length,u=typeof r[2];for("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2);++t"'`]/g,Wr=/^\[object .+?Constructor\]$/,Dr=/($^)/,zr=/[.*+?^${}()|[\]\/\\]/g,Cr=/['\n\r\u2028\u2029\\]/g,Pr="[object Arguments]",Vr="[object Boolean]",Gr="[object Date]",Hr="[object Error]",Jr="[object Number]",Kr="[object Object]",Lr="[object RegExp]",Qr="[object String]",Xr={}; -Xr[Pr]=Xr["[object Array]"]=Xr["[object Float32Array]"]=Xr["[object Float64Array]"]=Xr["[object Int8Array]"]=Xr["[object Int16Array]"]=Xr["[object Int32Array]"]=Xr["[object Uint8Array]"]=Xr["[object Uint8ClampedArray]"]=Xr["[object Uint16Array]"]=Xr["[object Uint32Array]"]=true,Xr["[object ArrayBuffer]"]=Xr[Vr]=Xr[Gr]=Xr[Hr]=Xr["[object Function]"]=Xr["[object Map]"]=Xr[Jr]=Xr[Kr]=Xr[Lr]=Xr["[object Set]"]=Xr[Qr]=Xr["[object WeakMap]"]=false;var Yr={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Zr={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},nt={"function":true,object:true},rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=nt[typeof window]&&window||this,et=nt[typeof exports]&&exports&&!exports.nodeType&&exports,ut=nt[typeof module]&&module&&!module.nodeType&&module,ot=et&&ut&&typeof global=="object"&&global; -!ot||ot.global!==ot&&ot.window!==ot&&ot.self!==ot||(tt=ot);var it=ut&&ut.exports===et&&et,ft=Array.prototype,at=Object.prototype,ct=Function.prototype.toString,lt=tt._,pt=at.toString,st=RegExp("^"+function(n){return n=null==n?"":n+"",zr.lastIndex=0,zr.test(n)?n.replace(zr,"\\$&"):n}(pt).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gt=Math.ceil,ht=Math.floor,vt=at.hasOwnProperty,yt=ft.push,mt=at.propertyIsEnumerable,bt=ft.splice,_t=z(_t=Object.create)&&_t,dt=z(dt=Array.isArray)&&dt,jt=tt.isFinite,wt=z(wt=Object.keys)&&wt,At=Math.max,xt=Math.min,Tt=z(Tt=Date.now)&&Tt,Et=Math.random,Ot={}; -!function(){var n={0:1,length:1};Ot.spliceObjects=(bt.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},_t||(v=function(){function n(){}return function(r){if(mr(r)){n.prototype=r;var t=new n;n.prototype=null}return t||tt.Object()}}());var kt=H,St=V,It=$(function(n,r,t){vt.call(n,t)?n[t]++:n[t]=1}),Ft=$(function(n,r,t){vt.call(n,t)?n[t].push(r):n[t]=[r]}),Mt=$(function(n,r,t){n[t]=r}),qt=$(function(n,r,t){n[t?0:1].push(r) -},function(){return[[],[]]}),Bt=lr(function(n,r){var t;if(!yr(r))throw new TypeError(qr);return function(){return 0<--n?t=r.apply(this,arguments):r=null,t}},2);hr(arguments)||(hr=function(n){var r=n&&typeof n=="object"?n.length:kr;return typeof r=="number"&&-1--n?r.apply(this,arguments):void 0}},o.bind=function(n,r){return 3>arguments.length?W(n,Sr,r):S(n,Sr|Fr,J(arguments,2),r)},o.bindAll=function(n){for(var r=n,t=1r?0:r)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=Nt(n),e=t.length,u={};++ro?0:o>>>0);for(t=h(t,e,3),b(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.take=St,o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!yr(n))throw new TypeError(funcErrorText);return false===t?e=false:mr(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),ar(n,r,{leading:e,maxWait:r,trailing:u}) -},o.times=function(n,r,t){n=jt(n=+n)&&-1r?0:r))},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?At(e+t,0):xt(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.max=tr,o.min=function(n,r,t){var e=1/0,u=e,o=typeof r; -if("number"!=o&&"string"!=o||!t||t[r]!==n||(r=null),null==r)for(t=-1,n=P(n),o=n.length;++tr?0:+r||0,n.length),n)},Er(pr({},o)),o.VERSION="3.0.0-pre",o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.value=function(){return this.__wrapped__ -},f("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ft[n];o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ot.spliceObjects||0!==n.length||delete n[0],this}}),f(["concat","join","slice"],function(n){var r=ft[n];o.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(tt._=o, define("underscore",function(){return o -})):et&&ut?it?(ut.exports=o)._=o:et._=o:tt._=o}).call(this); \ No newline at end of file +;(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(tu(r,i)&&o.push(i)}return o}function b(n,r){var t=n?n.length:0; +if(typeof t!="number"||-1>=t||t>Rr)return x(n,r,Ut);for(var e=-1,u=P(n);++e=t||t>Rr){for(var t=Ut(n),e=t.length;e--;){var u=t[e];if(r(n[u],u,n)===Br)break}return n}for(e=P(n);t--&&r(e[t],t,n)!==Br;);return n}function _(n,r){var t=true;return b(n,function(n,e,u){return(t=!!r(n,e,u))||Br}),t}function j(n,r){var t=[];return b(n,function(n,e,u){r(n,e,u)&&t.push(n)}),t}function w(n,r,t){var e;return t(n,function(n,t,u){return r(n,t,u)?(e=n,Br):void 0 +}),e}function A(n,r,t,e){e=(e||0)-1;for(var u=n.length,o=0,i=[];++ee(i,a)&&(r&&i.push(a),o.push(f))}return o}function $(n,r){return function(t,e,u){var o=r?r():{};if(e=g(e,u,3),Rt(t)){u=-1;for(var i=t.length;++ur?0:r)}function G(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?Tt(u+e,0):e||0;else if(e)return e=K(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function H(n,r,t){return J(n,null==r||t?1:0>r?0:r)}function J(n,r,t){var e=-1,u=n?n.length:0;for(r=null==r?0:+r||0,0>r?r=Tt(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=Tt(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1;t(n[o])u&&(u=i)}else r=g(r,t,3),b(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function er(n,r){return rr(n,kr(r))}function ur(n,r,t,e){return(Rt(n)?p:M)(n,g(r,e,4),t,3>arguments.length,b)}function or(n,r,t,e){return(Rt(n)?s:M)(n,g(r,e,4),t,3>arguments.length,d)}function ir(n){n=P(n);for(var r=-1,t=n.length,e=Array(t);++rarguments.length?W([n,Ir,null,r]):S(n,Ir|Mr,J(arguments,2),[],r)}function cr(n,r,t){function e(){var t=r-(Wt()-c);0>=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=Sr,t&&(h=Wt(),a=n.apply(l,i),p||f||(i=l=null))):p=setTimeout(e,t)}function u(){p&&clearTimeout(p),f=p=s=Sr,(v||g!==r)&&(h=Wt(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Wt(),l=this,s=v&&(p||!y),false===g)var t=y&&!p; +else{f||y||(h=c);var o=g-(c-h),m=0>=o||o>g;m?(f&&(f=clearTimeout(f)),h=c,a=n.apply(l,i)):f||(f=setTimeout(u,o))}return m&&p?p=clearTimeout(p):p||r===g||(p=setTimeout(e,r)),t&&(m=true,a=n.apply(l,i)),!m||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;if(!mr(n))throw new TypeError($r);if(r=0>r?0:r,true===t)var y=true,v=false;else br(t)&&(y=t.leading,g="maxWait"in t&&Tt(+t.maxWait||0,r),v="trailing"in t?t.trailing:v);return o.cancel=function(){p&&clearTimeout(p),f&&clearTimeout(f),f=p=s=Sr},o}function lr(n){if(!mr(n))throw new TypeError($r); +return function(){return!n.apply(this,arguments)}}function pr(n){for(var r=J(arguments,1),t=r,e=pr.placeholder,u=-1,o=t.length,i=[];++u"'`]/g,zr=/^\[object .+?Constructor\]$/,Cr=/($^)/,Pr=/[.*+?^${}()|[\]\/\\]/g,Vr=/['\n\r\u2028\u2029\\]/g,Gr="[object Arguments]",Hr="[object Boolean]",Jr="[object Date]",Kr="[object Error]",Lr="[object Number]",Qr="[object Object]",Xr="[object RegExp]",Yr="[object String]",Zr={}; +Zr[Gr]=Zr["[object Array]"]=Zr["[object Float32Array]"]=Zr["[object Float64Array]"]=Zr["[object Int8Array]"]=Zr["[object Int16Array]"]=Zr["[object Int32Array]"]=Zr["[object Uint8Array]"]=Zr["[object Uint8ClampedArray]"]=Zr["[object Uint16Array]"]=Zr["[object Uint32Array]"]=true,Zr["[object ArrayBuffer]"]=Zr[Hr]=Zr[Jr]=Zr[Kr]=Zr["[object Function]"]=Zr["[object Map]"]=Zr[Lr]=Zr[Qr]=Zr[Xr]=Zr["[object Set]"]=Zr[Yr]=Zr["[object WeakMap]"]=false;var nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},rt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},tt={"function":true,object:true},et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=tt[typeof window]&&window||this,ot=tt[typeof exports]&&exports&&!exports.nodeType&&exports,it=tt[typeof module]&&module&&!module.nodeType&&module,ft=ot&&it&&typeof global=="object"&&global; +!ft||ft.global!==ft&&ft.window!==ft&&ft.self!==ft||(ut=ft);var at=it&&it.exports===ot&&ot,ct=Array.prototype,lt=Object.prototype,pt=Function.prototype.toString,st=ut._,ht=lt.toString,gt=RegExp("^"+function(n){return n=null==n?"":n+"",Pr.lastIndex=0,Pr.test(n)?n.replace(Pr,"\\$&"):n}(ht).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vt=Math.ceil,yt=Math.floor,mt=lt.hasOwnProperty,bt=ct.push,dt=lt.propertyIsEnumerable,_t=ct.splice,jt=z(jt=Object.create)&&jt,wt=z(wt=Array.isArray)&&wt,At=ut.isFinite,xt=z(xt=Object.keys)&&xt,Tt=Math.max,Et=Math.min,Ot=z(Ot=Date.now)&&Ot,kt=Math.random,St={}; +!function(){var n={0:1,length:1};St.spliceObjects=(_t.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},jt||(v=function(){function n(){}return function(r){if(br(r)){n.prototype=r;var t=new n;n.prototype=null}return t||ut.Object()}}());var It=H,Ft=V,Mt=$(function(n,r,t){mt.call(n,t)?n[t]++:n[t]=1}),qt=$(function(n,r,t){mt.call(n,t)?n[t].push(r):n[t]=[r]}),Bt=$(function(n,r,t){n[t]=r}),$t=$(function(n,r,t){n[t?0:1].push(r) +},function(){return[[],[]]}),Nt=pr(function(n,r){var t;if(!mr(r))throw new TypeError($r);return function(){return 0<--n?t=r.apply(this,arguments):r=null,t}},2);vr(arguments)||(vr=function(n){var r=n&&typeof n=="object"?n.length:Sr;return typeof r=="number"&&-1--n?r.apply(this,arguments):void 0}},o.bind=ar,o.bindAll=function(n){for(var r=n,t=1r?0:r) +},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=Ut(n),e=t.length,u={};++ro?0:o>>>0);for(t=g(t,e,3),b(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.take=Ft,o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!mr(n))throw new TypeError(funcErrorText);return false===t?e=false:br(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),cr(n,r,{leading:e,maxWait:r,trailing:u}) +},o.times=function(n,r,t){n=At(n=+n)&&-1r?0:r))},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Tt(e+t,0):Et(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.max=tr,o.min=function(n,r,t){var e=1/0,u=e,o=typeof r; +if("number"!=o&&"string"!=o||!t||t[r]!==n||(r=null),null==r)for(t=-1,n=P(n),o=n.length;++tr?0:+r||0,n.length),n)},Or(sr({},o)),o.VERSION="3.0.0-pre",o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.value=function(){return this.__wrapped__ +},f("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),St.spliceObjects||0!==n.length||delete n[0],this}}),f(["concat","join","slice"],function(n){var r=ct[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?(ut._=o, define("underscore",function(){return o +})):ot&&it?at?(it.exports=o)._=o:ot._=o:ut._=o}).call(this); \ No newline at end of file