diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 20bfcb652..c020f04d1 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -25,7 +25,7 @@ PARTIAL_RIGHT_FLAG = 64; /** Used as the property name for wrapper metadata */ - var EXPANDO = '__lodash@' + VERSION + '__'; + var EXPANDO = '__lodash_' + VERSION.replace(/[-.]/g, '_') + '__'; /** Used as the TypeError message for "Functions" methods */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -40,6 +40,9 @@ */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + /** Used as the internal argument placeholder */ + var PLACEHOLDER = '__lodash_placeholder__'; + /** Used to generate unique IDs */ var idCounter = 0; @@ -129,7 +132,7 @@ ]; /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; + var templateCounter = -1; /** `Object#toString` result references */ var argsClass = '[object Arguments]', @@ -426,7 +429,7 @@ * @returns {number} Returns the sort order indicator for `object`. */ function compareAscending(object, other) { - return baseCompareAscending(object.criteria, other.criteria) || object.index - other.index; + return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); } /** @@ -661,7 +664,6 @@ bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, ceil = Math.ceil, clearTimeout = context.clearTimeout, - Float64Array = isNative(Float64Array = context.Float64Array) && Float64Array, floor = Math.floor, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, @@ -670,8 +672,19 @@ Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayProto.splice, - Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, - unshift = arrayProto.unshift; + Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array; + + /** Used to clone array buffers */ + var Float64Array = (function() { + // Safari 5 errors when using an array buffer to initialize a typed array + // where the array buffer's `byteLength` is not a multiple of the typed + // array's `BYTES_PER_ELEMENT` + try { + var func = isNative(func = context.Float64Array) && func, + result = new func(new ArrayBuffer(10), 0, 1) && func; + } catch(e) { } + return result; + }()); /** Used to set metadata on functions */ var defineProperty = (function() { @@ -698,7 +711,7 @@ nativeRandom = Math.random; /** Used as the size, in bytes, of each Float64Array element */ - var FLOAT64_BYTES_PER_ELEMENT = Float64Array && Float64Array.BYTES_PER_ELEMENT; + var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; /** Used to lookup a built-in constructor by [[Class]] */ var ctorByClass = {}; @@ -988,8 +1001,7 @@ * @type boolean */ try { - support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, argsKey) && - propertyIsEnumerable.call(arguments, argsKey)); + support.nonEnumArgs = !(hasOwnProperty.call(arguments, 1) && propertyIsEnumerable.call(arguments, 1)); } catch(e) { support.nonEnumArgs = true; } @@ -1058,26 +1070,6 @@ /*--------------------------------------------------------------------------*/ - /** - * 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. @@ -1589,7 +1581,7 @@ } if (isCurry || isCurryRight) { var placeholder = wrapper.placeholder, - newPartialHolders = getHolders(args, placeholder); + newPartialHolders = replaceHolders(args, placeholder); length -= newPartialHolders.length; @@ -1700,7 +1692,7 @@ iterable = toIterable(collection); while (++index < length) { - if (iterator(iterable[index], index, collection) === false) { + if (iterator(iterable[index], index, iterable) === false) { break; } } @@ -1723,7 +1715,7 @@ } var iterable = toIterable(collection); while (length--) { - if (iterator(iterable[length], length, collection) === false) { + if (iterator(iterable[length], length, iterable) === false) { break; } } @@ -1809,7 +1801,7 @@ function baseFlatten(array, isDeep, isStrict, fromIndex) { var index = (fromIndex || 0) - 1, length = array.length, - resIndex = 0, + resIndex = -1, result = []; while (++index < length) { @@ -1826,10 +1818,10 @@ result.length += valLength; while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; + result[++resIndex] = value[valIndex]; } } else if (!isStrict) { - result[resIndex++] = value; + result[++resIndex] = value; } } return result; @@ -2407,11 +2399,19 @@ high = array ? array.length : low; value = iterator(value); + var hintNum = typeof value == 'number' || + (value != null && isFunction(value.valueOf) && typeof value.valueOf() == 'number'); + while (low < high) { var mid = (low + high) >>> 1, - computed = iterator(array[mid]); + computed = iterator(array[mid]), + setLow = retHighest ? computed <= value : computed < value; - if (retHighest ? computed <= value : computed < value) { + if (hintNum && typeof computed != 'undefined') { + computed = +computed; + setLow = computed != computed || setLow; + } + if (setLow) { low = mid + 1; } else { high = mid; @@ -2821,29 +2821,21 @@ } // append partial left arguments if (isPartial) { - var partialHolders = data[5], - funcPartialArgs = funcData[4]; - + var funcPartialArgs = funcData[4]; if (funcPartialArgs) { - appendHolders(funcData[5], partialHolders, funcPartialArgs.length); - push.apply(funcPartialArgs, partialArgs); - } else { - funcData[4] = partialArgs; - funcData[5] = partialHolders; + funcPartialArgs = composeArgs(funcPartialArgs, funcData[5], partialArgs); } + funcData[4] = funcPartialArgs || partialArgs; + funcData[5] = funcPartialArgs ? replaceHolders(funcPartialArgs, PLACEHOLDER) : data[5]; } // prepend partial right arguments if (isPartialRight) { - var partialRightHolders = data[7], - funcPartialRightArgs = funcData[6]; - + var funcPartialRightArgs = funcData[6]; if (funcPartialRightArgs) { - appendHolders(funcData[7], partialRightHolders, funcPartialRightArgs.length); - unshift.apply(funcPartialRightArgs, partialRightArgs); - } else { - funcData[6] = partialRightArgs; - funcData[7] = partialRightHolders; + funcPartialRightArgs = composeArgsRight(funcPartialRightArgs, funcData[7], partialRightArgs); } + funcData[6] = funcPartialRightArgs || partialRightArgs; + funcData[7] = funcPartialRightArgs ? replaceHolders(funcPartialRightArgs, PLACEHOLDER) : data[7]; } // merge flags funcData[1] |= bitmask; @@ -2871,26 +2863,6 @@ return arguments.length ? result(func, thisArg, argCount) : result; } - /** - * Finds the indexes of all placeholder elements in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function getHolders(array, placeholder) { - var index = -1, - length = array.length, - result = []; - - while (++index < length) { - if (array[index] === placeholder) { - result.push(index); - } - } - return result; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized this function returns the custom method, otherwise it returns @@ -2974,6 +2946,29 @@ }; } + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + result = []; + + while (++index < length) { + if (array[index] === placeholder) { + array[index] = PLACEHOLDER; + result.push(index); + } + } + return result; + } + /** * Sets wrapper metadata on a given function. * @@ -3088,20 +3083,39 @@ } /** - * Converts `collection` to an array if it is not an array-like value. + * Converts `value` to an array-like object if it is not one. * * @private - * @param {Array|Object|string} collection The collection to process. - * @returns {Array} Returns the iterable object. + * @param {*} value The value to process. + * @returns {Array|Object} Returns the array-like object. */ - function toIterable(collection) { - var length = collection ? collection.length : 0; - if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { - return values(collection); - } else if (support.unindexedChars && isString(collection)) { - return collection.split(''); + function toIterable(value) { + if (value == null) { + return []; } - return collection || []; + var length = value.length; + if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { + return values(value); + } + value = toObject(value); + if (support.unindexedChars && isString(value)) { + var index = -1; + while (++index < length) { + value[index] = value.charAt(index); + } + } + return value; + } + + /** + * Converts `value` to an object if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); } /*--------------------------------------------------------------------------*/ @@ -3154,13 +3168,13 @@ function compact(array) { var index = -1, length = array ? array.length : 0, - resIndex = 0, + resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (value) { - result[resIndex++] = value; + result[++resIndex] = value; } } return result; @@ -3275,7 +3289,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. - * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -3324,6 +3338,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -3863,21 +3878,17 @@ start = start == null ? 0 : (+start || 0); if (start < 0) { - start = nativeMax(length + start, 0); - } else if (start > length) { - start = length; + start = -start > length ? 0 : (length + start); } - end = typeof end == 'undefined' ? length : (+end || 0); + end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); if (end < 0) { - end = nativeMax(length + end, 0); - } else if (end > length) { - end = length; + end += length; } length = start > end ? 0 : (end - start); var result = Array(length); while (++index < length) { - result[index] = array[start + index]; + result[index] = array[index + start]; } return result; } @@ -4039,6 +4050,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -4087,6 +4099,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -4575,7 +4588,7 @@ * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); }); /** @@ -4628,7 +4641,7 @@ } /** - * Iterates over elements of `collection` returning an array of all elements + * Iterates over elements of `collection`, returning an array of all elements * the predicate returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * @@ -4919,7 +4932,7 @@ }); /** - * Invokes the method named by `methodName` on each element in the collection + * Invokes the method named by `methodName` on each element in the collection, * returning an array of the results of each invoked method. Additional arguments * is provided to each invoked method. If `methodName` is a function it is * invoked for, and `this` bound to, each element in the collection. @@ -5346,10 +5359,9 @@ * // => [3, 1] */ function sample(collection, n, guard) { - collection = toIterable(collection); - - var length = collection.length; if (n == null || guard) { + collection = toIterable(collection); + var length = collection.length; return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -5563,8 +5575,13 @@ * // => [2, 3, 4] */ function toArray(collection) { - var iterable = toIterable(collection); - return iterable === collection ? slice(collection) : iterable; + var length = collection ? collection.length : 0; + if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) { + return (support.unindexedChars && isString(collection)) + ? collection.split('') + : slice(collection); + } + return values(collection); } /** @@ -5695,7 +5712,7 @@ return createWrapper([func, BIND_FLAG, null, thisArg]); } var args = slice(arguments, 2), - partialHolders = getHolders(args, bind.placeholder); + partialHolders = replaceHolders(args, bind.placeholder); return basePartial(func, BIND_FLAG | PARTIAL_FLAG, args, partialHolders, thisArg); } @@ -5773,7 +5790,7 @@ 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)); + data.push(args, replaceHolders(args, bindKey.placeholder)); } return createWrapper(data); } @@ -6248,7 +6265,7 @@ */ function partial(func) { var args = slice(arguments, 1), - partialHolders = getHolders(args, partial.placeholder); + partialHolders = replaceHolders(args, partial.placeholder); return basePartial(func, PARTIAL_FLAG, args, partialHolders); } @@ -6286,7 +6303,7 @@ */ function partialRight(func) { var args = slice(arguments, 1), - partialHolders = getHolders(args, partialRight.placeholder); + partialHolders = replaceHolders(args, partialRight.placeholder); return basePartial(func, PARTIAL_RIGHT_FLAG, args, partialHolders); } @@ -6565,7 +6582,6 @@ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Object} Returns the destination object. * @example * @@ -7395,7 +7411,7 @@ * // => ['x', 'y'] (property order is not guaranteed across environments) */ var keys = !nativeKeys ? shimKeys : function(object) { - object = Object(object); + object = toObject(object); var Ctor = object.constructor, length = object.length; @@ -7432,7 +7448,7 @@ if (object == null) { return []; } - object = Object(object); + object = toObject(object); var length = object.length; length = (typeof length == 'number' && length > 0 && @@ -7616,7 +7632,7 @@ return basePick(object, negate(getCallback(predicate, thisArg, 3))); } var omitProps = baseFlatten(arguments, false, false, 1); - return basePick(Object(object), baseDifference(keysIn(object), arrayMap(omitProps, String))); + return basePick(toObject(object), baseDifference(keysIn(object), arrayMap(omitProps, String))); } /** @@ -7677,7 +7693,7 @@ if (object == null) { return {}; } - return basePick(Object(object), + return basePick(toObject(object), typeof predicate == 'function' ? getCallback(predicate, thisArg, 3) : baseFlatten(arguments, false, false, 1) @@ -8257,7 +8273,7 @@ // use a sourceURL for easier debugging // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = options.sourceURL || ('/lodash/template/source[' + (templateCounter++) + ']'); + var sourceURL = options.sourceURL || ('/lodash/template/source[' + (++templateCounter) + ']'); sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { @@ -8842,19 +8858,27 @@ * @category Utility * @param {string} value The value to parse. * @param {number} [radix] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 */ - var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and - // Chrome fails to trim leading whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109 - value = trim(value); - return nativeParseInt(value, +radix || (reHexPrefix.test(value) ? 16 : 10)); - }; + function parseInt(value, radix, guard) { + return nativeParseInt(value, guard ? 0 : radix); + } + // fallback for environments with pre-ES5 implementations + if (nativeParseInt(whitespace + '08') != 8) { + parseInt = function(value, radix, guard) { + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and + // Chrome fails to trim leading whitespace characters. + // See https://code.google.com/p/v8/issues/detail?id=3109 + value = trim(value); + radix = guard ? 0 : +radix; + return nativeParseInt(value, radix || (reHexPrefix.test(value) ? 16 : 10)); + }; + } /** * Creates a "_.pluck" style function which returns the `key` value of a @@ -8914,6 +8938,11 @@ * // => a floating-point number between 1.2 and 5.2 */ function random(min, max, floating) { + // enables use as a callback for functions like `_.map` + var type = typeof max; + if ((type == 'number' || type == 'string') && floating && floating[max] === min) { + max = floating = null; + } var noMin = min == null, noMax = max == null; @@ -8979,6 +9008,12 @@ */ function range(start, end, step) { start = +start || 0; + + // enables use as a callback for functions like `_.map` + var type = typeof end; + if ((type == 'number' || type == 'string') && step && step[end] === start) { + end = step = null; + } step = step == null ? 1 : (+step || 0); if (end == null) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 6d593502f..359d9fb81 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,71 +4,72 @@ * 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(n=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 +}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=Fr(n);++e=r||r>k)return nr(n,t);for(var e=Fr(n);r--&&false!==t(e[r],r,e););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=-1,i=[];++e>>1,f=r(n[a]),l=e?f<=t:fo(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=Te(u);++re)return t;var u=typeof r[2]; +if("number"!=u&&"string"!=u||!r[3]||r[3][r[2]]!==r[1]||(e=2),3=t||t>k)return Ae(n);if(n=Ur(n),Cu.unindexedChars&&we(n))for(var r=-1;++re?_u(u+e,0):e||0;else if(e)return e=$r(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Nr(n){return Pr(n,1) +}function Pr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t,r=Te(u);++er?_u(e+r,0):r||0:0,typeof n=="string"||!Nu(n)&&we(n)?ro&&(o=a);else t=i&&a?u:Ar(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 Qr(n,t){return Gr(n,Ue(t))}function ne(n,t,r,e){return(Nu(n)?Rt:lr)(n,Ar(t,e,4),r,3>arguments.length,qt)}function te(n,t,r,e){return(Nu(n)?kt:lr)(n,Ar(t,e,4),r,3>arguments.length,Zt)}function re(n){n=Fr(n); +for(var t=-1,r=n.length,e=Te(r);++targuments.length)return jr([n,w,null,t]);var r=Pr(arguments,2),e=Sr(r,oe.placeholder);return ir(n,w|E,r,e,t)}function ie(n,t){var r=[t,w|j,null,n];if(2=r||r>t?(a&&ru(a),r=p,a=s=p=_,r&&(h=Zu(),f=n.apply(c,i),s||a||(i=c=null))):s=lu(e,r)}function u(){s&&ru(s),a=s=p=_,(v||g!==t)&&(h=Zu(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=Zu(),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=ru(a)),h=l,f=n.apply(c,i)):a||(a=lu(u,o))}return d&&s?s=ru(s):s||t===g||(s=lu(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(!de(n))throw new ze(S);if(t=0>t?0:t,true===r)var y=true,v=false;else me(r)&&(y=r.leading,g="maxWait"in r&&_u(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&ru(s),a&&ru(a),a=s=p=_},o}function ce(n){if(!de(n))throw new ze(S);return function(){return!n.apply(this,arguments)}}function se(n){var t=Pr(arguments,1),r=Sr(t,se.placeholder); +return ir(n,E,t,r)}function pe(n){var t=Pr(arguments,1),r=Sr(t,pe.placeholder);return ir(n,I,t,r)}function he(n){return tr(n,je)}function ge(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ge.call(n)==et||false}function ve(n){return n&&typeof n=="object"&&1===n.nodeType&&(Cu.nodeClass?-1t||null==n||!du(t))return r;n=Me(n);do t%2&&(r+=n),t=eu(t/2),n+=n; +while(t);return r}function Ee(n,t){return(n=null==n?"":Me(n))?null==t?n.slice(v(n),y(n)+1):(t=Me(t),n.slice(o(n,t),i(n,t)+1)):n}function Ie(n){try{return n()}catch(t){return ye(t)?t:We(t)}}function Ce(n,t){return Pt(n,t)}function Se(n){return n}function Re(n){var t=Bu(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Ir(u))return function(n){return null!=n&&u===n[e]&&ou.call(n,e)}}for(var o=r,i=Te(r),a=Te(r);o--;){var u=n[t[o]],f=Ir(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]]:!ou.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!ou.call(n,t[o]):!rr(a[o],n[t[o]],null,true))return false;return true}}function ke(n,t,r){var e=true,u=t&&tr(t,Bu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=tr(t,Bu)),false===r?e=false:me(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=de(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},g.assign=Wu,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),Pr(n,0,0>t?0:t)},g.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Ar(t,r,3);e--&&t(n[e],e,n););return Pr(n,0,e+1)},g.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Ar(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=Bu(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),Pr(n,0>t?0:t)},g.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Ar(t,r,3);e--&&t(n[e],e,n););return Pr(n,e+1)},g.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Ar(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?"":Me(n),$.lastIndex=0,$.test(n)?n.replace($,s):n +},g.escapeRegExp=xe,g.every=Kr,g.find=Yr,g.findIndex=Tr,g.findKey=function(n,t,r){return t=Ar(t,r,3),Yt(n,t,Qt,true)},g.findLast=function(n,t,r){return t=Ar(t,r,3),Yt(n,t,Zt)},g.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Ar(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},g.findLastKey=function(n,t,r){return t=Ar(t,r,3),Yt(n,t,nr,true)},g.findWhere=function(n,t){return Yr(n,Re(t))},g.first=Lr,g.has=function(n,t){return n?ou.call(n,t):false},g.identity=Se,g.indexOf=Wr,g.isArguments=ge,g.isArray=Nu,g.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ge.call(n)==ot||false +},g.isDate=function(n){return n&&typeof n=="object"&&Ge.call(n)==it||false},g.isElement=ve,g.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?_u(u+r,0):bu(r||0,u-1))+1;else if(r)return u=Br(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},g.max=Hr,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&&Nu(n))&&we(n);if(i&&!a)for(r=-1,n=Fr(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=Wu({},r||t,e,Wt),n=Me(null==n?"":n),r=Wu({},t.imports,e.imports,Wt); +var u,o,i=Bu(r),a=Ae(r),f=0;r=t.interpolate||J;var l="__p+='";if(r=De((t.escape||J).source+"|"+r.source+"|"+(r===M?z:J).source+"|"+(t.evaluate||J).source+"|$","g"),n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(H,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(L,""):l).replace(W,"$1").replace(N,"$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=Ie(function(){return Ne(i,"return "+l).apply(_,a) +}),t.source=l,ye(t))throw t;return t},g.trim=Ee,g.trimLeft=function(n,t){return(n=null==n?"":Me(n))?null==t?n.slice(v(n)):(t=Me(t),n.slice(o(n,t))):n},g.trimRight=function(n,t){return(n=null==n?"":Me(n))?null==t?n.slice(0,y(n)+1):(t=Me(t),n.slice(0,i(n,t)+1)):n},g.trunc=function(n,t){var r=30,e="...";if(me(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Me(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Me(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(be(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=De(u.source,(q.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 Y(o,u):o})}),g.VERSION=b,g.prototype.chain=function(){return this.__chain__=true,this},g.prototype.toJSON=qr,g.prototype.toString=function(){return Me(this.__wrapped__) +},g.prototype.value=qr,g.prototype.valueOf=qr,Q(["join","pop","shift"],function(n){var t=qe[n];g.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new Y(r,n):r}}),Q(["push","reverse","sort","unshift"],function(n){var t=qe[n];g.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Q(["concat","splice"],function(n){var t=qe[n];g.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Cu.spliceObjects||Q(["pop","shift","splice"],function(n){var t=qe[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 Y(u,n):u}}),g}var _,b="3.0.0-pre",w=1,j=2,A=4,x=8,O=16,E=32,I=64,C="__lodash_"+b.replace(/[-.]/g,"_")+"__",S="Expected a function",R=Math.pow(2,32)-1,k=Math.pow(2,53)-1,F="__lodash_placeholder__",U=0,T=/^[A-Z]+$/,L=/\b__p\+='';/g,W=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,P=/&(?:amp|lt|gt|quot|#39|#96);/g,$=/[&<>"'`]/g,B=/<%-([\s\S]+?)%>/g,D=/<%([\s\S]+?)%>/g,M=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,q=/\w*$/,Z=/^\s*function[ \n\r\t]+\w/,K=/^0[xX]/,V=/^\[object .+?Constructor\]$/,Y=/[\xC0-\xFF]/g,J=/($^)/,X=/[.*+?^${}()|[\]\/\\]/g,G=/\bthis\b/,H=/['\n\r\u2028\u2029\\]/g,Q=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g,nt=" \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",tt="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(" "),rt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Error]",ft="[object Function]",lt="[object Number]",ct="[object Object]",st="[object RegExp]",pt="[object String]",ht="[object ArrayBuffer]",gt="[object Float32Array]",vt="[object Float64Array]",yt="[object Int8Array]",dt="[object Int16Array]",mt="[object Int32Array]",_t="[object Uint8Array]",bt="[object Uint8ClampedArray]",wt="[object Uint16Array]",jt="[object Uint32Array]",At={}; +At[et]=At[ut]=At[gt]=At[vt]=At[yt]=At[dt]=At[mt]=At[_t]=At[bt]=At[wt]=At[jt]=true,At[ht]=At[ot]=At[it]=At[at]=At[ft]=At["[object Map]"]=At[lt]=At[ct]=At[st]=At["[object Set]"]=At[pt]=At["[object WeakMap]"]=false;var xt={};xt[et]=xt[ut]=xt[ht]=xt[ot]=xt[it]=xt[gt]=xt[vt]=xt[yt]=xt[dt]=xt[mt]=xt[lt]=xt[ct]=xt[st]=xt[pt]=xt[_t]=xt[bt]=xt[wt]=xt[jt]=true,xt[at]=xt[ft]=xt["[object Map]"]=xt["[object Set]"]=xt["[object WeakMap]"]=false;var Ot={leading:false,maxWait:0,trailing:false},Et={configurable:false,enumerable:false,value:null,writable:false},It={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ct={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},St={"\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":" "},Rt={"function":true,object:true},kt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ft=Rt[typeof window]&&window||this,Ut=Rt[typeof exports]&&exports&&!exports.nodeType&&exports,Rt=Rt[typeof module]&&module&&!module.nodeType&&module,Tt=Ut&&Rt&&typeof global=="object"&&global; +!Tt||Tt.global!==Tt&&Tt.window!==Tt&&Tt.self!==Tt||(Ft=Tt);var Tt=Rt&&Rt.exports===Ut&&Ut,Lt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ft._=Lt, define(function(){return Lt})):Ut&&Rt?Tt?(Rt.exports=Lt)._=Lt:Ut._=Lt:Ft._=Lt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 8ff5d0b0d..c4f291d03 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -25,7 +25,7 @@ PARTIAL_RIGHT_FLAG = 64; /** Used as the property name for wrapper metadata */ - var EXPANDO = '__lodash@' + VERSION + '__'; + var EXPANDO = '__lodash_' + VERSION.replace(/[-.]/g, '_') + '__'; /** Used as the TypeError message for "Functions" methods */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -40,6 +40,9 @@ */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + /** Used as the internal argument placeholder */ + var PLACEHOLDER = '__lodash_placeholder__'; + /** Used to generate unique IDs */ var idCounter = 0; @@ -123,7 +126,7 @@ ]; /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; + var templateCounter = -1; /** `Object#toString` result references */ var argsClass = '[object Arguments]', @@ -420,7 +423,7 @@ * @returns {number} Returns the sort order indicator for `object`. */ function compareAscending(object, other) { - return baseCompareAscending(object.criteria, other.criteria) || object.index - other.index; + return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); } /** @@ -641,7 +644,6 @@ bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, ceil = Math.ceil, clearTimeout = context.clearTimeout, - Float64Array = isNative(Float64Array = context.Float64Array) && Float64Array, floor = Math.floor, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, @@ -650,8 +652,19 @@ Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayProto.splice, - Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, - unshift = arrayProto.unshift; + Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array; + + /** Used to clone array buffers */ + var Float64Array = (function() { + // Safari 5 errors when using an array buffer to initialize a typed array + // where the array buffer's `byteLength` is not a multiple of the typed + // array's `BYTES_PER_ELEMENT` + try { + var func = isNative(func = context.Float64Array) && func, + result = new func(new ArrayBuffer(10), 0, 1) && func; + } catch(e) { } + return result; + }()); /** Used to set metadata on functions */ var defineProperty = (function() { @@ -678,7 +691,7 @@ nativeRandom = Math.random; /** Used as the size, in bytes, of each Float64Array element */ - var FLOAT64_BYTES_PER_ELEMENT = Float64Array && Float64Array.BYTES_PER_ELEMENT; + var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; /*--------------------------------------------------------------------------*/ @@ -831,8 +844,7 @@ * @type boolean */ try { - support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, argsKey) && - propertyIsEnumerable.call(arguments, argsKey)); + support.nonEnumArgs = !(hasOwnProperty.call(arguments, 1) && propertyIsEnumerable.call(arguments, 1)); } catch(e) { support.nonEnumArgs = true; } @@ -901,26 +913,6 @@ /*--------------------------------------------------------------------------*/ - /** - * 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. @@ -1428,7 +1420,7 @@ } if (isCurry || isCurryRight) { var placeholder = wrapper.placeholder, - newPartialHolders = getHolders(args, placeholder); + newPartialHolders = replaceHolders(args, placeholder); length -= newPartialHolders.length; @@ -1539,7 +1531,7 @@ iterable = toIterable(collection); while (++index < length) { - if (iterator(iterable[index], index, collection) === false) { + if (iterator(iterable[index], index, iterable) === false) { break; } } @@ -1562,7 +1554,7 @@ } var iterable = toIterable(collection); while (length--) { - if (iterator(iterable[length], length, collection) === false) { + if (iterator(iterable[length], length, iterable) === false) { break; } } @@ -1648,7 +1640,7 @@ function baseFlatten(array, isDeep, isStrict, fromIndex) { var index = (fromIndex || 0) - 1, length = array.length, - resIndex = 0, + resIndex = -1, result = []; while (++index < length) { @@ -1665,10 +1657,10 @@ result.length += valLength; while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; + result[++resIndex] = value[valIndex]; } } else if (!isStrict) { - result[resIndex++] = value; + result[++resIndex] = value; } } return result; @@ -2242,11 +2234,19 @@ high = array ? array.length : low; value = iterator(value); + var hintNum = typeof value == 'number' || + (value != null && isFunction(value.valueOf) && typeof value.valueOf() == 'number'); + while (low < high) { var mid = (low + high) >>> 1, - computed = iterator(array[mid]); + computed = iterator(array[mid]), + setLow = retHighest ? computed <= value : computed < value; - if (retHighest ? computed <= value : computed < value) { + if (hintNum && typeof computed != 'undefined') { + computed = +computed; + setLow = computed != computed || setLow; + } + if (setLow) { low = mid + 1; } else { high = mid; @@ -2656,29 +2656,21 @@ } // append partial left arguments if (isPartial) { - var partialHolders = data[5], - funcPartialArgs = funcData[4]; - + var funcPartialArgs = funcData[4]; if (funcPartialArgs) { - appendHolders(funcData[5], partialHolders, funcPartialArgs.length); - push.apply(funcPartialArgs, partialArgs); - } else { - funcData[4] = partialArgs; - funcData[5] = partialHolders; + funcPartialArgs = composeArgs(funcPartialArgs, funcData[5], partialArgs); } + funcData[4] = funcPartialArgs || partialArgs; + funcData[5] = funcPartialArgs ? replaceHolders(funcPartialArgs, PLACEHOLDER) : data[5]; } // prepend partial right arguments if (isPartialRight) { - var partialRightHolders = data[7], - funcPartialRightArgs = funcData[6]; - + var funcPartialRightArgs = funcData[6]; if (funcPartialRightArgs) { - appendHolders(funcData[7], partialRightHolders, funcPartialRightArgs.length); - unshift.apply(funcPartialRightArgs, partialRightArgs); - } else { - funcData[6] = partialRightArgs; - funcData[7] = partialRightHolders; + funcPartialRightArgs = composeArgsRight(funcPartialRightArgs, funcData[7], partialRightArgs); } + funcData[6] = funcPartialRightArgs || partialRightArgs; + funcData[7] = funcPartialRightArgs ? replaceHolders(funcPartialRightArgs, PLACEHOLDER) : data[7]; } // merge flags funcData[1] |= bitmask; @@ -2706,26 +2698,6 @@ return arguments.length ? result(func, thisArg, argCount) : result; } - /** - * Finds the indexes of all placeholder elements in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function getHolders(array, placeholder) { - var index = -1, - length = array.length, - result = []; - - while (++index < length) { - if (array[index] === placeholder) { - result.push(index); - } - } - return result; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized this function returns the custom method, otherwise it returns @@ -2809,6 +2781,29 @@ }; } + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + result = []; + + while (++index < length) { + if (array[index] === placeholder) { + array[index] = PLACEHOLDER; + result.push(index); + } + } + return result; + } + /** * Sets wrapper metadata on a given function. * @@ -2910,18 +2905,33 @@ } /** - * Converts `collection` to an array if it is not an array-like value. + * Converts `value` to an array-like object if it is not one. * * @private - * @param {Array|Object|string} collection The collection to process. - * @returns {Array} Returns the iterable object. + * @param {*} value The value to process. + * @returns {Array|Object} Returns the array-like object. */ - function toIterable(collection) { - var length = collection ? collection.length : 0; - if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { - return values(collection); + function toIterable(value) { + if (value == null) { + return []; } - return collection || []; + var length = value.length; + if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { + return values(value); + } + value = toObject(value); + return value; + } + + /** + * Converts `value` to an object if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); } /*--------------------------------------------------------------------------*/ @@ -2974,13 +2984,13 @@ function compact(array) { var index = -1, length = array ? array.length : 0, - resIndex = 0, + resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (value) { - result[resIndex++] = value; + result[++resIndex] = value; } } return result; @@ -3095,7 +3105,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. - * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -3144,6 +3154,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -3683,21 +3694,17 @@ start = start == null ? 0 : (+start || 0); if (start < 0) { - start = nativeMax(length + start, 0); - } else if (start > length) { - start = length; + start = -start > length ? 0 : (length + start); } - end = typeof end == 'undefined' ? length : (+end || 0); + end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); if (end < 0) { - end = nativeMax(length + end, 0); - } else if (end > length) { - end = length; + end += length; } length = start > end ? 0 : (end - start); var result = Array(length); while (++index < length) { - result[index] = array[start + index]; + result[index] = array[index + start]; } return result; } @@ -3859,6 +3866,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -3907,6 +3915,7 @@ * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=identity] The function called * per element. + * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * @@ -4395,7 +4404,7 @@ * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); }); /** @@ -4448,7 +4457,7 @@ } /** - * Iterates over elements of `collection` returning an array of all elements + * Iterates over elements of `collection`, returning an array of all elements * the predicate returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * @@ -4739,7 +4748,7 @@ }); /** - * Invokes the method named by `methodName` on each element in the collection + * Invokes the method named by `methodName` on each element in the collection, * returning an array of the results of each invoked method. Additional arguments * is provided to each invoked method. If `methodName` is a function it is * invoked for, and `this` bound to, each element in the collection. @@ -5166,10 +5175,9 @@ * // => [3, 1] */ function sample(collection, n, guard) { - collection = toIterable(collection); - - var length = collection.length; if (n == null || guard) { + collection = toIterable(collection); + var length = collection.length; return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -5383,8 +5391,11 @@ * // => [2, 3, 4] */ function toArray(collection) { - var iterable = toIterable(collection); - return iterable === collection ? slice(collection) : iterable; + var length = collection ? collection.length : 0; + if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) { + return slice(collection); + } + return values(collection); } /** @@ -5515,7 +5526,7 @@ return createWrapper([func, BIND_FLAG, null, thisArg]); } var args = slice(arguments, 2), - partialHolders = getHolders(args, bind.placeholder); + partialHolders = replaceHolders(args, bind.placeholder); return basePartial(func, BIND_FLAG | PARTIAL_FLAG, args, partialHolders, thisArg); } @@ -5593,7 +5604,7 @@ 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)); + data.push(args, replaceHolders(args, bindKey.placeholder)); } return createWrapper(data); } @@ -6068,7 +6079,7 @@ */ function partial(func) { var args = slice(arguments, 1), - partialHolders = getHolders(args, partial.placeholder); + partialHolders = replaceHolders(args, partial.placeholder); return basePartial(func, PARTIAL_FLAG, args, partialHolders); } @@ -6106,7 +6117,7 @@ */ function partialRight(func) { var args = slice(arguments, 1), - partialHolders = getHolders(args, partialRight.placeholder); + partialHolders = replaceHolders(args, partialRight.placeholder); return basePartial(func, PARTIAL_RIGHT_FLAG, args, partialHolders); } @@ -6385,7 +6396,6 @@ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Object} Returns the destination object. * @example * @@ -7201,7 +7211,7 @@ * // => ['x', 'y'] (property order is not guaranteed across environments) */ var keys = !nativeKeys ? shimKeys : function(object) { - object = Object(object); + object = toObject(object); var Ctor = object.constructor, length = object.length; @@ -7237,7 +7247,7 @@ if (object == null) { return []; } - object = Object(object); + object = toObject(object); var length = object.length; length = (typeof length == 'number' && length > 0 && @@ -7397,7 +7407,7 @@ return basePick(object, negate(getCallback(predicate, thisArg, 3))); } var omitProps = baseFlatten(arguments, false, false, 1); - return basePick(Object(object), baseDifference(keysIn(object), arrayMap(omitProps, String))); + return basePick(toObject(object), baseDifference(keysIn(object), arrayMap(omitProps, String))); } /** @@ -7458,7 +7468,7 @@ if (object == null) { return {}; } - return basePick(Object(object), + return basePick(toObject(object), typeof predicate == 'function' ? getCallback(predicate, thisArg, 3) : baseFlatten(arguments, false, false, 1) @@ -8038,7 +8048,7 @@ // use a sourceURL for easier debugging // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = options.sourceURL || ('/lodash/template/source[' + (templateCounter++) + ']'); + var sourceURL = options.sourceURL || ('/lodash/template/source[' + (++templateCounter) + ']'); sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { @@ -8623,19 +8633,27 @@ * @category Utility * @param {string} value The value to parse. * @param {number} [radix] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 */ - var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and - // Chrome fails to trim leading whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109 - value = trim(value); - return nativeParseInt(value, +radix || (reHexPrefix.test(value) ? 16 : 10)); - }; + function parseInt(value, radix, guard) { + return nativeParseInt(value, guard ? 0 : radix); + } + // fallback for environments with pre-ES5 implementations + if (nativeParseInt(whitespace + '08') != 8) { + parseInt = function(value, radix, guard) { + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and + // Chrome fails to trim leading whitespace characters. + // See https://code.google.com/p/v8/issues/detail?id=3109 + value = trim(value); + radix = guard ? 0 : +radix; + return nativeParseInt(value, radix || (reHexPrefix.test(value) ? 16 : 10)); + }; + } /** * Creates a "_.pluck" style function which returns the `key` value of a @@ -8695,6 +8713,11 @@ * // => a floating-point number between 1.2 and 5.2 */ function random(min, max, floating) { + // enables use as a callback for functions like `_.map` + var type = typeof max; + if ((type == 'number' || type == 'string') && floating && floating[max] === min) { + max = floating = null; + } var noMin = min == null, noMax = max == null; @@ -8760,6 +8783,12 @@ */ function range(start, end, step) { start = +start || 0; + + // enables use as a callback for functions like `_.map` + var type = typeof end; + if ((type == 'number' || type == 'string') && step && step[end] === start) { + end = step = null; + } step = step == null ? 1 : (+step || 0); if (end == null) { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index c3417fbd8..c1771afb5 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,67 +4,68 @@ * 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(n=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 +}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=kr(n);++e=r||r>S)return Gt(n,t);for(var e=kr(n);r--&&false!==t(e[r],r,e););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=-1,i=[];++e>>1,a=r(n[f]),c=e?a<=t:ao(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=Ce(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?vu(u+e,0):e||0;else if(e)return e=Nr(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Ur(n){return Wr(n,1)}function Wr(n,t,r){var e=-1,u=n?n.length:0;for(t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t,r=Ce(u);++er?vu(e+r,0):r||0:0,typeof n=="string"||!Cu(n)&&me(n)?ro&&(o=f);else t=i&&f?u:br(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 Xr(n,t){return Yr(n,Se(t))}function Gr(n,t,r,e){return(Cu(n)?It:ir)(n,br(t,e,4),r,3>arguments.length,Mt)}function Hr(n,t,r,e){return(Cu(n)?Rt:ir)(n,br(t,e,4),r,3>arguments.length,zt)}function Qr(n){n=kr(n);for(var t=-1,r=n.length,e=Ce(r);++targuments.length)return _r([n,b,null,t]);var r=Wr(arguments,2),e=Or(r,re.placeholder);return er(n,b|E,r,e,t)}function ee(n,t){var r=[t,b|w,null,n];if(2=r||r>t?(f&&He(f),r=s,f=p=s=m,r&&(h=Bu(),a=n.apply(l,i),p||f||(i=l=null))):p=ou(e,r)}function u(){p&&He(p),f=p=s=m,(v||g!==t)&&(h=Bu(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Bu(),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=He(f)),h=c,a=n.apply(l,i)):f||(f=ou(u,o))}return d&&p?p=He(p):p||t===g||(p=ou(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(!ge(n))throw new De(R);if(t=0>t?0:t,true===r)var y=true,v=false;else ve(r)&&(y=r.leading,g="maxWait"in r&&vu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){p&&He(p),f&&He(f),f=p=s=m},o}function fe(n){if(!ge(n))throw new De(R);return function(){return!n.apply(this,arguments)}}function ae(n){var t=Wr(arguments,1),r=Or(t,ae.placeholder);return er(n,E,t,r)}function ce(n){var t=Wr(arguments,1),r=Or(t,ce.placeholder);return er(n,O,t,r)}function le(n){return Ht(n,_e) +}function pe(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ve.call(n)==tt||false}function se(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=Ce(r),f=0t||null==n||!hu(t))return r;n=Be(n);do t%2&&(r+=n),t=Qe(t/2),n+=n;while(t);return r}function Ae(n,t){return(n=null==n?"":Be(n))?null==t?n.slice(g(n),v(n)+1):(t=Be(t),n.slice(o(n,t),i(n,t)+1)):n}function xe(n){try{return n()}catch(t){return he(t)?t:Te(t)}}function Ee(n,t){return Wt(n,t)}function Oe(n){return n}function Ie(n){var t=Uu(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(xr(u))return function(n){return null!=n&&u===n[e]&&tu.call(n,e)}}for(var o=r,i=Ce(r),f=Ce(r);o--;){var u=n[t[o]],a=xr(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]]:!tu.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!tu.call(n,t[o]):!Qt(f[o],n[t[o]],null,true))return false;return true}}function Re(n,t,r){var e=true,u=t&&Ht(t,Uu);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Ht(t,Uu)),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}},h.assign=Su,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),Wr(n,0,0>t?0:t)},h.dropRightWhile=function(n,t,r){var e=n?n.length:0; +for(t=br(t,r,3);e--&&t(n[e],e,n););return Wr(n,0,e+1)},h.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=br(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=Uu(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),Wr(n,0>t?0:t)},h.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=br(t,r,3);e--&&t(n[e],e,n););return Wr(n,e+1)},h.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},h.escape=function(n){return n=null==n?"":Be(n),$.lastIndex=0,$.test(n)?n.replace($,p):n +},h.escapeRegExp=we,h.every=qr,h.find=Zr,h.findIndex=Cr,h.findKey=function(n,t,r){return t=br(t,r,3),Zt(n,t,Xt,true)},h.findLast=function(n,t,r){return t=br(t,r,3),Zt(n,t,zt)},h.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},h.findLastKey=function(n,t,r){return t=br(t,r,3),Zt(n,t,Gt,true)},h.findWhere=function(n,t){return Zr(n,Ie(t))},h.first=Fr,h.has=function(n,t){return n?tu.call(n,t):false},h.identity=Oe,h.indexOf=Tr,h.isArguments=pe,h.isArray=Cu,h.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ve.call(n)==et||false +},h.isDate=function(n){return n&&typeof n=="object"&&Ve.call(n)==ut||false},h.isElement=se,h.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?vu(u+r,0):yu(r||0,u-1))+1;else if(r)return u=Lr(n,t)-1,e&&n[u]===t?u:-1;for(;u--;)if(n[u]===t)return u;return-1},h.max=Jr,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&&Cu(n))&&me(n);if(i&&!f)for(r=-1,n=kr(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=Su({},r||t,e,Tt),n=Be(null==n?"":n),r=Su({},t.imports,e.imports,Tt); +var u,o,i=Uu(r),f=be(r),a=0;r=t.interpolate||Y;var c="__p+='";if(r=$e((t.escape||Y).source+"|"+r.source+"|"+(r===M?z:Y).source+"|"+(t.evaluate||Y).source+"|$","g"),n.replace(r,function(t,r,e,i,f,l){return e||(e=i),c+=n.slice(a,l).replace(G,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(U,""):c).replace(W,"$1").replace(N,"$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=xe(function(){return Ue(i,"return "+c).apply(m,f) +}),t.source=c,he(t))throw t;return t},h.trim=Ae,h.trimLeft=function(n,t){return(n=null==n?"":Be(n))?null==t?n.slice(g(n)):(t=Be(t),n.slice(o(n,t))):n},h.trimRight=function(n,t){return(n=null==n?"":Be(n))?null==t?n.slice(0,v(n)+1):(t=Be(t),n.slice(0,i(n,t)+1)):n},h.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?Be(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Be(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,f,a=n.slice(0,o);for(u.global||(u=$e(u.source,(q.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 V(o,u):o})}),h.VERSION=_,h.prototype.chain=function(){return this.__chain__=true,this},h.prototype.toJSON=Mr,h.prototype.toString=function(){return Be(this.__wrapped__) +},h.prototype.value=Mr,h.prototype.valueOf=Mr,H(["join","pop","shift"],function(n){var t=Me[n];h.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),H(["push","reverse","sort","unshift"],function(n){var t=Me[n];h.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),H(["concat","splice"],function(n){var t=Me[n];h.prototype[n]=function(){return new V(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,O=64,I="__lodash_"+_.replace(/[-.]/g,"_")+"__",R="Expected a function",k=Math.pow(2,32)-1,S=Math.pow(2,53)-1,C="__lodash_placeholder__",F=0,T=/^[A-Z]+$/,U=/\b__p\+='';/g,W=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,L=/&(?:amp|lt|gt|quot|#39|#96);/g,$=/[&<>"'`]/g,B=/<%-([\s\S]+?)%>/g,D=/<%([\s\S]+?)%>/g,M=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,q=/\w*$/,P=/^\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="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Error]",it="[object Number]",ft="[object Object]",at="[object RegExp]",ct="[object String]",lt="[object ArrayBuffer]",pt="[object Float32Array]",st="[object Float64Array]",ht="[object Int8Array]",gt="[object Int16Array]",vt="[object Int32Array]",yt="[object Uint8Array]",dt="[object Uint8ClampedArray]",mt="[object Uint16Array]",_t="[object Uint32Array]",bt={}; +bt[tt]=bt[rt]=bt[pt]=bt[st]=bt[ht]=bt[gt]=bt[vt]=bt[yt]=bt[dt]=bt[mt]=bt[_t]=true,bt[lt]=bt[et]=bt[ut]=bt[ot]=bt["[object Function]"]=bt["[object Map]"]=bt[it]=bt[ft]=bt[at]=bt["[object Set]"]=bt[ct]=bt["[object WeakMap]"]=false;var wt={};wt[tt]=wt[rt]=wt[lt]=wt[et]=wt[ut]=wt[pt]=wt[st]=wt[ht]=wt[gt]=wt[vt]=wt[it]=wt[ft]=wt[at]=wt[ct]=wt[yt]=wt[dt]=wt[mt]=wt[_t]=true,wt[ot]=wt["[object Function]"]=wt["[object Map]"]=wt["[object Set]"]=wt["[object WeakMap]"]=false;var jt={leading:false,maxWait:0,trailing:false},At={configurable:false,enumerable:false,value:null,writable:false},xt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Et={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ot={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"AE","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\xd7":" ","\xf7":" "},It={"function":true,object:true},Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},kt=It[typeof window]&&window||this,St=It[typeof exports]&&exports&&!exports.nodeType&&exports,It=It[typeof module]&&module&&!module.nodeType&&module,Ct=St&&It&&typeof global=="object"&&global; +!Ct||Ct.global!==Ct&&Ct.window!==Ct&&Ct.self!==Ct||(kt=Ct);var Ct=It&&It.exports===St&&St,Ft=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(kt._=Ft, define(function(){return Ft})):St&&It?Ct?(It.exports=Ft)._=Ft:St._=Ft:kt._=Ft}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 9ec0d3894..13ced1ca4 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -25,7 +25,7 @@ PARTIAL_RIGHT_FLAG = 64; /** Used as the property name for wrapper metadata */ - var EXPANDO = '__lodash@' + VERSION + '__'; + var EXPANDO = '__lodash_' + VERSION.replace(/[-.]/g, '_') + '__'; /** Used by methods to exit iteration */ var breakIndicator = EXPANDO + 'breaker__'; @@ -43,6 +43,9 @@ */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + /** Used as the internal argument placeholder */ + var PLACEHOLDER = '__lodash_placeholder__'; + /** Used to generate unique IDs */ var idCounter = 0; @@ -233,7 +236,7 @@ * @returns {number} Returns the sort order indicator for `object`. */ function compareAscending(object, other) { - return baseCompareAscending(object.criteria, other.criteria) || object.index - other.index; + return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); } /** @@ -813,7 +816,7 @@ iterable = toIterable(collection); while (++index < length) { - if (iterator(iterable[index], index, collection) === breakIndicator) { + if (iterator(iterable[index], index, iterable) === breakIndicator) { break; } } @@ -836,7 +839,7 @@ } var iterable = toIterable(collection); while (length--) { - if (iterator(iterable[length], length, collection) === breakIndicator) { + if (iterator(iterable[length], length, iterable) === breakIndicator) { break; } } @@ -922,7 +925,7 @@ function baseFlatten(array, isDeep, isStrict, fromIndex) { var index = (fromIndex || 0) - 1, length = array.length, - resIndex = 0, + resIndex = -1, result = []; while (++index < length) { @@ -939,10 +942,10 @@ result.length += valLength; while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; + result[++resIndex] = value[valIndex]; } } else if (!isStrict) { - result[resIndex++] = value; + result[++resIndex] = value; } } return result; @@ -1359,11 +1362,19 @@ high = array ? array.length : low; value = iterator(value); + var hintNum = typeof value == 'number' || + (value != null && isFunction(value.valueOf) && typeof value.valueOf() == 'number'); + while (low < high) { var mid = (low + high) >>> 1, - computed = iterator(array[mid]); + computed = iterator(array[mid]), + setLow = retHighest ? computed <= value : computed < value; - if (retHighest ? computed <= value : computed < value) { + if (hintNum && typeof computed != 'undefined') { + computed = +computed; + setLow = computed != computed || setLow; + } + if (setLow) { low = mid + 1; } else { high = mid; @@ -1616,26 +1627,6 @@ return baseCreateWrapper(data); } - /** - * Finds the indexes of all placeholder elements in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function getHolders(array, placeholder) { - var index = -1, - length = array.length, - result = []; - - while (++index < length) { - if (array[index] === placeholder) { - result.push(index); - } - } - return result; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized this function returns the custom method, otherwise it returns @@ -1665,6 +1656,29 @@ : (value && type == 'object' && reHostCtor.test(toString.call(value))) || false; } + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + result = []; + + while (++index < length) { + if (array[index] === placeholder) { + array[index] = PLACEHOLDER; + result.push(index); + } + } + return result; + } + /** * A fallback implementation of `Object.keys` which creates an array of the * own enumerable property names of `object`. @@ -1716,18 +1730,33 @@ } /** - * Converts `collection` to an array if it is not an array-like value. + * Converts `value` to an array-like object if it is not one. * * @private - * @param {Array|Object|string} collection The collection to process. - * @returns {Array} Returns the iterable object. + * @param {*} value The value to process. + * @returns {Array|Object} Returns the array-like object. */ - function toIterable(collection) { - var length = collection ? collection.length : 0; - if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { - return values(collection); + function toIterable(value) { + if (value == null) { + return []; } - return collection || []; + var length = value.length; + if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { + return values(value); + } + value = toObject(value); + return value; + } + + /** + * Converts `value` to an object if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); } /*--------------------------------------------------------------------------*/ @@ -1749,13 +1778,13 @@ function compact(array) { var index = -1, length = array ? array.length : 0, - resIndex = 0, + resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (value) { - result[resIndex++] = value; + result[++resIndex] = value; } } return result; @@ -2141,21 +2170,17 @@ start = start == null ? 0 : (+start || 0); if (start < 0) { - start = nativeMax(length + start, 0); - } else if (start > length) { - start = length; + start = -start > length ? 0 : (length + start); } - end = typeof end == 'undefined' ? length : (+end || 0); + end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); if (end < 0) { - end = nativeMax(length + end, 0); - } else if (end > length) { - end = length; + end += length; } length = start > end ? 0 : (end - start); var result = Array(length); while (++index < length) { - result[index] = array[start + index]; + result[index] = array[index + start]; } return result; } @@ -2604,7 +2629,7 @@ * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); }); /** @@ -2657,7 +2682,7 @@ } /** - * Iterates over elements of `collection` returning an array of all elements + * Iterates over elements of `collection`, returning an array of all elements * the predicate returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * @@ -2902,7 +2927,7 @@ }); /** - * Invokes the method named by `methodName` on each element in the collection + * Invokes the method named by `methodName` on each element in the collection, * returning an array of the results of each invoked method. Additional arguments * is provided to each invoked method. If `methodName` is a function it is * invoked for, and `this` bound to, each element in the collection. @@ -3319,10 +3344,9 @@ * // => [3, 1] */ function sample(collection, n, guard) { - collection = toIterable(collection); - - var length = collection.length; if (n == null || guard) { + collection = toIterable(collection); + var length = collection.length; return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -3524,8 +3548,11 @@ * // => [2, 3, 4] */ function toArray(collection) { - var iterable = toIterable(collection); - return iterable === collection ? slice(collection) : iterable; + var length = collection ? collection.length : 0; + if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) { + return slice(collection); + } + return values(collection); } /** @@ -4090,7 +4117,7 @@ */ function partial(func) { var args = slice(arguments, 1), - partialHolders = getHolders(args, partial.placeholder); + partialHolders = replaceHolders(args, partial.placeholder); return basePartial(func, PARTIAL_FLAG, args, partialHolders); } @@ -4294,7 +4321,6 @@ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Object} Returns the destination object. * @example * @@ -4933,7 +4959,7 @@ return {}; } var omitProps = baseFlatten(arguments, false, false, 1); - return basePick(Object(object), baseDifference(keysIn(object), arrayMap(omitProps, String))); + return basePick(toObject(object), baseDifference(keysIn(object), arrayMap(omitProps, String))); } /** @@ -4993,7 +5019,7 @@ function pick(object) { return object == null ? {} - : basePick(Object(object), baseFlatten(arguments, false, false, 1)); + : basePick(toObject(object), baseFlatten(arguments, false, false, 1)); } /** @@ -5558,6 +5584,12 @@ */ function range(start, end, step) { start = +start || 0; + + // enables use as a callback for functions like `_.map` + var type = typeof end; + if ((type == 'number' || type == 'string') && step && step[end] === start) { + end = step = null; + } step = +step || 1; if (end == null) { diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 98f796e74..e3771cecf 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,43 +3,44 @@ * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash underscore -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(te||typeof t=="undefined"){t=1;break n}if(tu(r,i)&&o.push(i)}return o}function b(n,r){var t=n?n.length:0; -if(typeof t!="number"||-1>=t||t>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 +return false}function g(n,r,t){var e=typeof n;if("function"==e){if(typeof r=="undefined")return n;switch(t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)};case 5:return function(t,e,u,o,i){return n.call(r,t,e,u,o,i)}}return function(){return n.apply(r,arguments)}}return null==n?Tr:"object"==e?Er(n):kr(n)}function v(n){return br(n)?wt(n):{}}function y(n){function r(){for(var n=arguments.length,t=n,n=Array(n);t--;)n[t]=arguments[t]; +if(i){for(var t=n,n=e.length,c=-1,l=Et(t.length-n,0),p=-1,s=i.length,h=Array(l+s);++pu(r,i)&&o.push(i)}return o}function b(n,r){var t=n?n.length:0; +if(typeof t!="number"||-1>=t||t>Rr)return x(n,r,Wt);for(var e=-1,u=P(n);++e=t||t>Rr){for(var t=Wt(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,e)!==Br;);return n}function d(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=-1,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),Ut(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?Et(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=-r>u?0:u+r),t=typeof t=="undefined"||t>u?u:+t||0,0>t&&(t+=u),u=r>t?0:t-r,t=Array(u);++e>>1,f=t(n[i]),a=fu&&(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(Ut(n)?p:M)(n,g(r,e,4),t,3>arguments.length,b) +}function or(n,r,t,e){return(Ut(n)?s:M)(n,g(r,e,4),t,3>arguments.length,_)}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-(Dt()-c);0>=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=Sr,t&&(h=Dt(),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=Dt(),a=n.apply(l,i),p||f||(i=l=null))}function o(){if(i=arguments,c=Dt(),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&&Et(+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,Cr=/^\[object .+?Constructor\]$/,Pr=/($^)/,Vr=/[.*+?^${}()|[\]\/\\]/g,Gr=/['\n\r\u2028\u2029\\]/g,Hr="[object Arguments]",Jr="[object Boolean]",Kr="[object Date]",Lr="[object Error]",Qr="[object Number]",Xr="[object Object]",Yr="[object RegExp]",Zr="[object String]",nt={}; +nt[Hr]=nt["[object Array]"]=nt["[object Float32Array]"]=nt["[object Float64Array]"]=nt["[object Int8Array]"]=nt["[object Int16Array]"]=nt["[object Int32Array]"]=nt["[object Uint8Array]"]=nt["[object Uint8ClampedArray]"]=nt["[object Uint16Array]"]=nt["[object Uint32Array]"]=true,nt["[object ArrayBuffer]"]=nt[Jr]=nt[Kr]=nt[Lr]=nt["[object Function]"]=nt["[object Map]"]=nt[Qr]=nt[Xr]=nt[Yr]=nt["[object Set]"]=nt[Zr]=nt["[object WeakMap]"]=false;var rt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},tt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},et={"function":true,object:true},ut={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ot=et[typeof window]&&window||this,it=et[typeof exports]&&exports&&!exports.nodeType&&exports,ft=et[typeof module]&&module&&!module.nodeType&&module,at=it&&ft&&typeof global=="object"&&global; +!at||at.global!==at&&at.window!==at&&at.self!==at||(ot=at);var ct=ft&&ft.exports===it&&it,lt=Array.prototype,pt=Object.prototype,st=Function.prototype.toString,ht=ot._,gt=pt.toString,vt=RegExp("^"+function(n){return n=null==n?"":n+"",Vr.lastIndex=0,Vr.test(n)?n.replace(Vr,"\\$&"):n}(gt).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),yt=Math.ceil,mt=Math.floor,bt=pt.hasOwnProperty,_t=lt.push,dt=pt.propertyIsEnumerable,jt=lt.splice,wt=z(wt=Object.create)&&wt,At=z(At=Array.isArray)&&At,xt=ot.isFinite,Tt=z(Tt=Object.keys)&&Tt,Et=Math.max,Ot=Math.min,kt=z(kt=Date.now)&&kt,St=Math.random,It={}; +!function(){var n={0:1,length:1};It.spliceObjects=(jt.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},wt||(v=function(){function n(){}return function(r){if(br(r)){n.prototype=r;var t=new n;n.prototype=null}return t||ot.Object()}}());var Ft=H,Mt=V,qt=$(function(n,r,t){bt.call(n,t)?++n[t]:n[t]=1}),Bt=$(function(n,r,t){bt.call(n,t)?n[t].push(r):n[t]=[r]}),$t=$(function(n,r,t){n[t]=r}),Nt=$(function(n,r,t){n[t?0:1].push(r) +},function(){return[[],[]]}),Rt=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=Wt(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=Mt,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=xt(n=+n)&&-1r?0:r))},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Et(e+t,0):Ot(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=lt[n];o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),It.spliceObjects||0!==n.length||delete n[0],this}}),f(["concat","join","slice"],function(n){var r=lt[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?(ot._=o, define("underscore",function(){return o +})):it&&ft?ct?(ft.exports=o)._=o:it._=o:ot._=o}).call(this); \ No newline at end of file