diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 2b6c51a1a..9cc32cc8e 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -4,7 +4,7 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Copyright 2012-2014 The Dojo Foundation * Based on Underscore.js 1.6.0 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ ;(function() { @@ -50,7 +50,7 @@ */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - /** Used to match regexp flags from their coerced string values */ + /** Used to match `RegExp` flags from their coerced string values */ var reFlags = /\w*$/; /** Used to detected named functions */ @@ -66,8 +66,8 @@ var reNoMatch = /($^)/; /** - * Used to match RegExp special characters. - * See this [article on RegExp characters](http://www.regular-expressions.info/characters.html#special) + * Used to match `RegExp` special characters. + * See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special) * for more details. */ var reRegExpChars = /[.*+?^${}()|[\]\\]/g; @@ -100,13 +100,13 @@ 'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError' ]; - /** Used to fix the JScript [[DontEnum]] bug */ + /** Used to fix the JScript `[[DontEnum]]` bug */ var shadowedProps = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; - /** Used to make template sourceURLs easier to identify */ + /** Used to make template `sourceURL`s easier to identify */ var templateCounter = 0; /** `Object#toString` result shortcuts */ @@ -195,7 +195,7 @@ '\xDF': 'ss', '\xD7': ' ', '\xF7': ' ' }; - /** Used to determine if values are of the language type Object */ + /** Used to determine if values are of the language type `Object` */ var objectTypes = { 'function': true, 'object': true @@ -316,6 +316,7 @@ * * @private * @param {string} string The string to inspect. + * @param {string} chars The chars to find. * @returns {number} Returns the index of the first character not found in `chars`. */ function charsLeftIndex(string, chars) { @@ -335,6 +336,7 @@ * * @private * @param {string} string The string to inspect. + * @param {string} chars The chars to find. * @returns {number} Returns the index of the last character not found in `chars`. */ function charsRightIndex(string, chars) { @@ -348,7 +350,7 @@ } /** - * Used by `sortBy` to compare transformed elements of a collection and stable + * Used by `_.sortBy` to compare transformed elements of a collection and stable * sort them in ascending order. * * @private @@ -361,7 +363,7 @@ } /** - * Used by `sortBy` to compare multiple properties of each element in a + * Used by `_.sortBy` to compare multiple properties of each element in a * collection and stable sort them in ascending order. * * @private @@ -425,7 +427,7 @@ } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. @@ -436,7 +438,7 @@ } /** - * Used by `template` to escape characters for inclusion in compiled + * Used by `_.template` to escape characters for inclusion in compiled * string literals. * * @private @@ -461,7 +463,7 @@ } /** - * A fallback implementation of `trim` to remove leading and trailing + * A fallback implementation of `String#trim` to remove leading and trailing * whitespace or specified characters from `string`. * * @private @@ -482,7 +484,7 @@ } /** - * A fallback implementation of `trimLeft` to remove leading whitespace or + * A fallback implementation of `String#trimLeft` to remove leading whitespace or * specified characters from `string`. * * @private @@ -503,7 +505,7 @@ } /** - * A fallback implementation of `trimRight` to remove trailing whitespace or + * A fallback implementation of `String#trimRight` to remove trailing whitespace or * specified characters from `string`. * * @private @@ -564,7 +566,7 @@ } /** - * Used by `unescape` to convert HTML entities to characters. + * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. @@ -577,7 +579,7 @@ /*--------------------------------------------------------------------------*/ /** - * Create a new `lodash` function using the given context object. + * Create a new `lodash` function using the given `context` object. * * @static * @memberOf _ @@ -614,17 +616,17 @@ /** Used to detect DOM support */ var document = (document = context.window) && document.document; - /** Used to restore the original `_` reference in `noConflict` */ + /** Used to restore the original `_` reference in `_.noConflict` */ var oldDash = context._; /** - * Used as the maximum length an array-like object. + * Used as the maximum length of an array-like object. * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. */ var maxSafeInteger = Math.pow(2, 53) - 1; - /** Used to resolve the internal [[Class]] of values */ + /** Used to resolve the internal `[[Class]]` of values */ var toString = objectProto.toString; /** Used to detect if a method is native */ @@ -647,7 +649,7 @@ splice = arrayRef.splice, unshift = arrayRef.unshift; - /** Used to set meta data on functions */ + /** Used to set metadata on functions */ var defineProperty = (function() { // IE 8 only accepts DOM elements try { @@ -674,7 +676,7 @@ nativeTrimLeft = isNative(nativeTrimLeft = stringProto.trimLeft) && !nativeTrimLeft.call(whitespace) && nativeTrimLeft, nativeTrimRight = isNative(nativeTrimRight = stringProto.trimRight) && !nativeTrimRight.call(whitespace) && nativeTrimRight; - /** Used to lookup a built-in constructor by [[Class]] */ + /** Used to lookup a built-in constructor by `[[Class]]` */ var ctorByClass = {}; ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; @@ -785,7 +787,7 @@ * * @private * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} [chainAll=false] A flag to enable chaining for all methods + * @param {boolean} [chainAll=false] A flag to enable chaining for all methods. * @returns {Object} Returns a `lodash` instance. */ function lodashWrapper(value, chainAll) { @@ -814,7 +816,7 @@ for (key in arguments) { } /** - * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). + * Detect if an `arguments` object's `[[Class]]` is resolvable (all but Firefox < 4, IE < 9). * * @memberOf _.support * @type boolean @@ -843,8 +845,8 @@ * * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 * (if the prototype or a property on the prototype has been set) - * incorrectly sets a function's `prototype` property [[Enumerable]] - * value to `true`. + * incorrectly sets the `[[Enumerable]]` value of a function's `prototype` + * property to `true`. * * @memberOf _.support * @type boolean @@ -881,7 +883,7 @@ * Detect if properties shadowing those on `Object.prototype` are non-enumerable. * * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). + * made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). * * @memberOf _.support * @type boolean @@ -934,7 +936,7 @@ } /** - * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9) + * Detect if a DOM node's `[[Class]]` is resolvable (all but IE < 9) * and that the JS engine errors when attempting to coerce an object to * a string without a `toString` function. * @@ -1013,7 +1015,7 @@ /** * The base implementation of `_.bind` that creates the bound function and - * sets its meta data. + * sets its metadata. * * @private * @param {Array} data The metadata array. @@ -1074,7 +1076,7 @@ return result; } } - // inspect [[Class]] + // inspect `[[Class]]` var isObj = isObject(value); if (isObj) { var className = toString.call(value); @@ -1228,7 +1230,7 @@ /** * The base implementation of `createWrapper` that creates the wrapper and - * sets its meta data. + * sets its metadata. * * @private * @param {Array} data The metadata array. @@ -1392,7 +1394,7 @@ } /** - * The base implementation of `find`, 'findLast`, `findKey`, and `findLastKey` + * The base implementation of `_.find`, '_.findLast`, `_.findKey`, and `_.findLastKey` * without support for callback shorthands or `this` binding which iterates * over `collection` using the provided `eachFunc`. * @@ -1578,7 +1580,7 @@ (valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object'))) { return false; } - // compare [[Class]] names + // compare `[[Class]]` names var valClass = toString.call(value), othClass = toString.call(other), valIsArg = valClass == argsClass, @@ -2163,7 +2165,7 @@ }; /** - * A fallback implementation of `isPlainObject` which checks if `value` is + * A fallback implementation of `_.isPlainObject` which checks if `value` is * an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and * that there are no `Object.prototype` extensions. @@ -2215,11 +2217,17 @@ var index = -1, props = keysIn(object), length = props.length, + objLength = length && object.length, result = []; + if (typeof objLength == 'number' && objLength > 0) { + var allowIndexes = isArray(object) || (support.unindexedChars && isString(object)), + maxIndex = objLength - 1; + } while (++index < length) { var key = props[index]; - if (hasOwnProperty.call(object, key)) { + if ((allowIndexes && key > -1 && key <= maxIndex && key % 1 == 0) || + hasOwnProperty.call(object, key)) { result.push(key); } } @@ -2272,8 +2280,8 @@ * _.difference([1, 2, 3], [5, 2, 10]); * // => [1, 3] */ - function difference(array) { - return baseDifference(array, baseFlatten(arguments, true, true, 1)); + function difference() { + return baseDifference(arguments[0], baseFlatten(arguments, true, true, 1)); } /** @@ -2710,46 +2718,43 @@ * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); * // => [1, 2] */ - function intersection(array) { - if (!array) { - return []; - } + function intersection() { var args = [], argsIndex = -1, argsLength = arguments.length, caches = [], indexOf = getIndexOf(), - prereq = createCache && indexOf === baseIndexOf, - seen = []; + prereq = createCache && indexOf === baseIndexOf; while (++argsIndex < argsLength) { var value = arguments[argsIndex]; if (isArray(value) || isArguments(value)) { args.push(value); caches.push(prereq && value.length >= 120 && - createCache(argsIndex ? value : seen)); + createCache(argsIndex && value)); } } argsLength = args.length; var array = args[0], index = -1, length = array ? array.length : 0, - result = []; + result = [], + seen = caches[0]; outer: while (++index < length) { - var cache = caches[0]; value = array[index]; - - if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value)) < 0) { argsIndex = argsLength; - (cache || seen).push(value); while (--argsIndex) { - cache = caches[argsIndex]; + var cache = caches[argsIndex]; if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } + if (seen) { + seen.push(value); + } result.push(value); } } @@ -3427,9 +3432,7 @@ * // => 'pebbles is 1' */ function chain(value) { - value = new lodashWrapper(value); - value.__chain__ = true; - return value; + return new lodashWrapper(value, true); } /** @@ -4906,7 +4909,7 @@ * @static * @memberOf _ * @category Functions - * @param {...Function} [func] Functions to compose. + * @param {...Function} [funcs] Functions to compose. * @returns {Function} Returns the new composed function. * @example * @@ -4992,7 +4995,7 @@ * the leading and/or trailing edge of the `wait` timeout. Subsequent calls * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true` `func` will be called + * Note: If `leading` and `trailing` options are `true`, `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -5368,7 +5371,7 @@ * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true` `func` will be called + * Note: If `leading` and `trailing` options are `true`, `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -5989,7 +5992,7 @@ return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == argsClass || false; } - // fallback for environments that can't detect `arguments` objects by [[Class]] + // fallback for environments that can't detect `arguments` objects by `[[Class]]` if (!support.argsClass) { isArguments = function(value) { return value && typeof value == 'object' && typeof value.length == 'number' && @@ -6250,7 +6253,7 @@ } /** - * Checks if `value` is the language type of Object. + * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -6270,7 +6273,7 @@ * // => false */ function isObject(value) { - // check if the value is the ECMAScript language type of Object + // check if the value is the ECMAScript language type of `Object` // http://es5.github.io/#x8 // and avoid a V8 bug // https://code.google.com/p/v8/issues/detail?id=2291 @@ -6306,7 +6309,7 @@ */ function isNaN(value) { // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) + // (perform the `[[Class]]` check first to avoid errors with some host objects in IE) return isNumber(value) && value != +value; } @@ -6478,8 +6481,8 @@ * // => ['x', 'y'] (property order is not guaranteed across environments) */ var keys = !nativeKeys ? shimKeys : function(object) { - if ((support.enumPrototypes && typeof object == 'function') || - (support.nonEnumArgs && object && object.length && isArguments(object))) { + var length = object ? object.length : 0; + if (typeof length == 'number' && length > 0) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; @@ -6506,19 +6509,30 @@ * // => ['x', 'y', 'z'] (property order is not guaranteed across environments) */ function keysIn(object) { - var result = []; if (!isObject(object)) { - return result; + return []; } - if (support.nonEnumArgs && object.length && isArguments(object)) { - object = slice(object); - } - var skipProto = support.enumPrototypes && typeof object == 'function', - skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); + var length = object.length; + length = (typeof length == 'number' && length > 0 && + (isArray(object) || (support.unindexedChars && isString(object)) || + (support.nonEnumArgs && isArguments(object))) && length) >>> 0; + var maxIndex = length - 1, + result = Array(length), + skipIndexes = length > 0, + skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error), + skipProto = support.enumPrototypes && typeof object == 'function'; + + if (skipIndexes) { + var index = -1; + while (++index < length) { + result[index] = String(index); + } + } for (var key in object) { if (!(skipProto && key == 'prototype') && - !(skipErrorProps && (key == 'message' || key == 'name'))) { + !(skipErrorProps && (key == 'message' || key == 'name')) && + !(skipIndexes && key > -1 && key <= maxIndex && key % 1 == 0)) { result.push(key); } } @@ -6527,9 +6541,9 @@ // attribute of an existing property and the `constructor` property of a // prototype defaults to non-enumerable. if (support.nonEnumShadows && object !== objectProto) { - var ctor = object.constructor, - index = -1, - length = shadowedProps.length; + var ctor = object.constructor; + index = -1; + length = shadowedProps.length; if (object === (ctor && ctor.prototype)) { var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), @@ -6996,7 +7010,7 @@ } /** - * Escapes the RegExp special characters "\", "^", "$", ".", "|", "?", "*", + * Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*", * "+", "(", ")", "[", "]", "{" and "}" in `string`. * * @static @@ -7232,7 +7246,7 @@ * settings object is provided it will override `_.templateSettings` for the * template. * - * Note: In the development build, `_.template` utilizes sourceURLs for easier debugging. + * Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * @@ -7252,7 +7266,7 @@ * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as local variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. + * @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @returns {Function|string} Returns the interpolated string if a data object * is provided, else the compiled template function. @@ -7290,7 +7304,7 @@ * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); * // => '
  • fred
  • barney
  • ' * - * // using the `sourceURL` option to specify a custom sourceURL for the template + * // using the `sourceURL` option to specify a custom `sourceURL` for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector @@ -7396,7 +7410,7 @@ source + 'return __p\n}'; - // Use a sourceURL for easier debugging. + // Use a `sourceURL` for easier debugging. // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; @@ -7496,7 +7510,7 @@ * @static * @memberOf _ * @category Strings - * @param {string} [string=''] The string to trim. + * @param {string} [string=''] The string to truncate. * @param {Object|number} [options] The options object or maximum string length. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string used to indicate text is omitted. @@ -7866,7 +7880,7 @@ /** * Converts `value` to an integer of the specified radix. If `radix` is - * `undefined` or `0` a `radix` of `10` is used unless `value` is a hexadecimal, + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, * in which case a `radix` of `16` is used. * * Note: This method avoids differences in native ES3 and ES5 `parseInt` diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index a42fda14b..7eaa54f1e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -6,63 +6,64 @@ ;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202a(t,l)&&f.push(l);return f}function pt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1i(s,h)&&((u||f)&&s.push(h),c.push(p))}return c}function Et(n,t){for(var r=-1,e=t(n),u=e.length,o=Ir(u);++rr&&(r=0),s&&(a=[]),p&&(i=[]),h=[n,t,r,e,u,o,a,i],t==x||t==(x|O)?c(h):X(h)) -}function Nt(){var n=(n=o.indexOf)===$t?r:n;return n}function Tt(n){return typeof n=="function"&&Yr.test(Qr.call(n))}function Lt(n){var t,r;return!n||Xr.call(n)!=ot||!te.call(n,"constructor")&&(t=n.constructor,gr(t)&&!(t instanceof t))||!ke.argsClass&&pr(n)||!ke.nodeClass&&h(n)?false:ke.ownLast?(_t(n,function(n,t,e){return r=te.call(e,t),false}),false!==r):(_t(n,function(n,t){r=t}),typeof r=="undefined"||te.call(n,r))}function Wt(n){for(var t=-1,r=br(n),e=r.length,u=[];++ta?0:a)}function $t(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?ve(0,u+e):e||0;else if(e)return e=Ut(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Dt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,a=0; -for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)a++}else a=null==t||r?1:t;return a=e-a,qt(n,0,0>a?0:a)}function zt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,a=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)a++}else if(a=t,null==a||r)return n?n[e-1]:w;return a=e-a,qt(n,0>a?0:a)}function Bt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,a=0;for(t=o.createCallback(t,r,3);++et?0:t;return qt(n,a)}function qt(n,t,r){var e=-1,u=n?n.length:0; -for(t=+t||0,0>t?t=ve(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=ve(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Ir(u);++e>>1,r(n[e])r?0:r);++tr?ve(0,e+r):r,-1u?0:u>>>0);if(t=o.createCallback(t,r,3),Te(n))for(;++ea&&(a=l)}else t=null==t&&dr(n)?u:o.createCallback(t,r,3),pt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n) -});return a}function rr(n,t,r,e){var u=3>arguments.length;if(t=o.createCallback(t,e,4),Te(n)){var a=-1,i=n.length;for(u&&i&&(r=n[++a]);++aarguments.length;return t=o.createCallback(t,e,4),ht(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function ur(n){var t=-1,r=n&&n.length,e=Ir(0>r?0:r>>>0);return pt(n,function(n){var r=kt(0,++t);e[t]=e[r],e[r]=n}),e}function or(n,t,r){var e;if(t=o.createCallback(t,r,3),Te(n)){r=-1; -for(var u=n.length;++rarguments.length)return Rt(n,x,null,t);if(n)var r=n[S]?n[S][2]:n.length,e=qt(arguments,2),r=r-e.length;return Rt(n,x|O,r,t,e)}function ir(n,t,r){function e(){c&&Hr(c),a=c=s=w,(g||h!==t)&&(p=qe(),i=n.apply(f,o),c||a||(o=f=null))}function u(){var r=t-(qe()-l);0>=r||r>t?(a&&Hr(a),r=s,a=c=s=w,r&&(p=qe(),i=n.apply(f,o),c||a||(o=f=null))):c=oe(u,r)}var o,a,i,l,f,c,s,p=0,h=false,g=true; -if(!gr(n))throw new zr;if(t=0>t?0:t,true===r)var v=true,g=false;else vr(r)&&(v=r.leading,h="maxWait"in r&&(ve(t,r.maxWait)||0),g="trailing"in r?r.trailing:g);return function(){if(o=arguments,l=qe(),f=this,s=g&&(c||!v),false===h)var r=v&&!c;else{a||v||(p=l);var y=h-(l-p),m=0>=y||y>h;m?(a&&(a=Hr(a)),p=l,i=n.apply(f,o)):a||(a=oe(e,y))}return m&&c?c=Hr(c):c||t===h||(c=oe(u,t)),r&&(m=true,i=n.apply(f,o)),!m||c||a||(o=f=null),i}}function lr(n){if(!gr(n))throw new zr;return function(){return!n.apply(this,arguments) -}}function fr(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,a=typeof r;if("number"!=a&&"string"!=a||!e[3]||e[3][r]!==t||(o=2),3arguments.length)return t;var r=qt(arguments);return r.push(n),fr.apply(null,r)}function sr(n){var t=[];return _t(n,function(n,r){gr(n)&&t.push(r) -}),t.sort()}function pr(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Xr.call(n)==J||false}function hr(n){return n&&typeof n=="object"&&1===n.nodeType&&(ke.nodeClass?-1t||null==n)return r;n=Dr(n);do t%2&&(r+=n),t=Jr(t/2),n+=n;while(t);return r}function jr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||U(n,t,r):"object"!=e?Sr(n):Or(n) -}function kr(n){return n}function Or(n){n||(n={});var t=We(n),r=t.length,e=t[0],u=n[e];return 1!=r||u!==u||vr(u)?function(e){for(var u=r,o=false;u--&&(o=t[u],o=te.call(e,o)&&Ct(e[o],n[o],null,true)););return o}:function(n){return te.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function Er(n,t,r){var e=true,u=t&&sr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=o,u=sr(t)),false===r?e=false:vr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var a=gr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},o.assign=fr,o.at=function(n,t){var r=arguments,e=-1,u=vt(r,true,false,1),o=u.length,a=typeof t;for("number"!=a&&"string"!=a||!r[2]||r[2][t]!==n||(o=1),ke.unindexedChars&&dr(n)&&(n=n.split("")),r=Ir(o);++earguments.length?Rt(t,x|C,null,n):Rt(t,x|C|O,null,n,qt(arguments,2))},o.chain=function(n){return n=new a(n),n.__chain__=true,n},o.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(h?e(h,c):i(f,c))){for(u=o,(h||f).push(c);--u;)if(h=a[u],0>(h?e(h,c):i(t[u],c)))continue n; -p.push(c)}}return p},o.invert=function(n,t){for(var r=-1,e=We(n),u=e.length,o={};++ro?0:o>>>0);return pt(n,function(n){var o=u?t:null!=n&&n[t];a[++e]=o?o.apply(n,r):w}),a},o.keys=We,o.keysIn=br,o.map=nr,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),wt(n,function(n,r,u){e[r]=t(n,r,u)}),e},o.matches=Or,o.max=tr,o.memoize=function(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0]; -return te.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}if(!gr(n))throw new zr;return r.cache={},r},o.merge=function(n,t,r){if(!n)return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(a||(t=o.createCallback(t,r,3)),pt(n,function(n,r,u){if(a)for(r=t.length,u=Ir(r);r--;)u[r]=n[t[r]]; -else u=t(n,r,u);f[++e]={a:u,b:e,c:n}}),u=f.length,f.sort(a?l:i);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,r){return t.call(r,n),n},o.throttle=function(n,t,r){var e=true,u=true;if(!gr(n))throw new zr;return false===r?e=false:vr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,ir(n,t,ft)},o.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Ir(n);for(t=U(t,r,1);++er?ve(0,e+r):ye(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=Er,o.noConflict=function(){return t._=Vr,this},o.noop=Ar,o.now=qe,o.pad=function(n,t,r){n=null==n?"":Dr(n),t|=0;var e=n.length;return e=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(mr(u)){if(n.slice(o).search(u)){var a,i,l=n.slice(0,o);for(u.global||(u=$r(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;a=u.exec(l);)i=a.index; -r=r.slice(0,null==i?o:i)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(L,b))},o.uniqueId=function(n){var t=++I;return Dr(null==n?"":n)+t},o.all=Yt,o.any=or,o.detect=Ht,o.findWhere=Ht,o.foldl=rr,o.foldr=er,o.include=Xt,o.inject=rr,Er(function(){var n={};return wt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=Pt,o.last=zt,o.sample=function(n,t,r){return n&&typeof n.length!="number"?n=wr(n):ke.unindexedChars&&dr(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0a(t,l)&&f.push(l);return f}function pt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1i(s,h)&&((u||f)&&s.push(h),c.push(p))}return c}function Ot(n,t){for(var r=-1,e=t(n),u=e.length,o=Sr(u);++rr&&(r=0),s&&(a=[]),p&&(i=[]),h=[n,t,r,e,u,o,a,i],t==x||t==(x|O)?c(h):X(h)) +}function Rt(){var n=(n=o.indexOf)===Pt?r:n;return n}function Nt(n){return typeof n=="function"&&Xr.test(Jr.call(n))}function Tt(n){var t,r;return!n||Zr.call(n)!=ot||!ne.call(n,"constructor")&&(t=n.constructor,hr(t)&&!(t instanceof t))||!je.argsClass&&sr(n)||!je.nodeClass&&h(n)?false:je.ownLast?(mt(n,function(n,t,e){return r=ne.call(e,t),false},dr),false!==r):(mt(n,function(n,t){r=t},dr),typeof r=="undefined"||ne.call(n,r))}function Lt(n){var t=-1,r=dr(n),e=r.length,u=e&&n.length,o=[];if(typeof u=="number"&&0a?0:a)}function Pt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?ge(0,u+e):e||0;else if(e)return e=qt(n,t),u&&n[e]===t?e:-1; +return r(n,t,e)}function $t(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,a=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)a++}else a=null==t||r?1:t;return a=e-a,Bt(n,0,0>a?0:a)}function Dt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,a=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)a++}else if(a=t,null==a||r)return n?n[e-1]:w;return a=e-a,Bt(n,0>a?0:a)}function zt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,a=0;for(t=o.createCallback(t,r,3);++et?0:t;return Bt(n,a)}function Bt(n,t,r){var e=-1,u=n?n.length:0;for(t=+t||0,0>t?t=ge(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=ge(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Sr(u);++e>>1,r(n[e])r?0:r);++tr?ge(0,e+r):r,-1u?0:u>>>0);if(t=o.createCallback(t,r,3),Ne(n))for(;++ea&&(a=l)}else t=null==t&&mr(n)?u:o.createCallback(t,r,3),pt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function tr(n,t,r,e){var u=3>arguments.length;if(t=o.createCallback(t,e,4),Ne(n)){var a=-1,i=n.length;for(u&&i&&(r=n[++a]);++aarguments.length;return t=o.createCallback(t,e,4),ht(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function er(n){var t=-1,r=n&&n.length,e=Sr(0>r?0:r>>>0); +return pt(n,function(n){var r=jt(0,++t);e[t]=e[r],e[r]=n}),e}function ur(n,t,r){var e;if(t=o.createCallback(t,r,3),Ne(n)){r=-1;for(var u=n.length;++rarguments.length)return It(n,x,null,t);if(n)var r=n[S]?n[S][2]:n.length,e=Bt(arguments,2),r=r-e.length;return It(n,x|O,r,t,e)}function ar(n,t,r){var e,u,o,a,i,l,f,c=0,s=false,p=true;if(!hr(n))throw new Dr;if(t=0>t?0:t,true===r)var h=true,p=false;else gr(r)&&(h=r.leading,s="maxWait"in r&&(ge(t,r.maxWait)||0),p="trailing"in r?r.trailing:p); +var g=function(){var r=t-(Be()-a);0>=r||r>t?(u&&Gr(u),r=f,u=l=f=w,r&&(c=Be(),o=n.apply(i,e),l||u||(e=i=null))):l=ue(g,r)},v=function(){l&&Gr(l),u=l=f=w,(p||s!==t)&&(c=Be(),o=n.apply(i,e),l||u||(e=i=null))};return function(){if(e=arguments,a=Be(),i=this,f=p&&(l||!h),false===s)var r=h&&!l;else{u||h||(c=a);var y=s-(a-c),m=0>=y||y>s;m?(u&&(u=Gr(u)),c=a,o=n.apply(i,e)):u||(u=ue(v,y))}return m&&l?l=Gr(l):l||t===s||(l=ue(g,t)),r&&(m=true,o=n.apply(i,e)),!m||l||u||(e=i=null),o}}function ir(n){if(!hr(n))throw new Dr; +return function(){return!n.apply(this,arguments)}}function lr(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,a=typeof r;if("number"!=a&&"string"!=a||!e[3]||e[3][r]!==t||(o=2),3arguments.length)return t;var r=Bt(arguments);return r.push(n),lr.apply(null,r) +}function cr(n){var t=[];return mt(n,function(n,r){hr(n)&&t.push(r)},dr),t.sort()}function sr(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Zr.call(n)==J||false}function pr(n){return n&&typeof n=="object"&&1===n.nodeType&&(je.nodeClass?-1>>0,r=t-1,e=Sr(t),u=0t||null==n)return r;n=$r(n);do t%2&&(r+=n),t=Hr(t/2),n+=n;while(t);return r}function Cr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||U(n,t,r):"object"!=e?Ar(n):kr(n)}function jr(n){return n}function kr(n){n||(n={});var t=Le(n),r=t.length,e=t[0],u=n[e];return 1!=r||u!==u||gr(u)?function(e){for(var u=r,o=false;u--&&(o=t[u],o=ne.call(e,o)&&xt(e[o],n[o],null,true)););return o}:function(n){return ne.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false +}}function Or(n,t,r){var e=true,u=t&&cr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=o,u=cr(t)),false===r?e=false:gr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var a=hr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},o.assign=lr,o.at=function(n,t){var r=arguments,e=-1,u=vt(r,true,false,1),o=u.length,a=typeof t;for("number"!=a&&"string"!=a||!r[2]||r[2][t]!==n||(o=1),je.unindexedChars&&mr(n)&&(n=n.split("")),r=Sr(o);++earguments.length?It(t,x|C,null,n):It(t,x|C|O,null,n,Bt(arguments,2))},o.chain=function(n){return new a(n,true)},o.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?e(p,l):a(s,l))){for(t=u;--t;){var h=o[t];if(0>(h?e(h,l):a(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},o.invert=function(n,t){for(var r=-1,e=Le(n),u=e.length,o={};++ro?0:o>>>0);return pt(n,function(n){var o=u?t:null!=n&&n[t];a[++e]=o?o.apply(n,r):w}),a},o.keys=Le,o.keysIn=dr,o.map=Qt,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),_t(n,function(n,r,u){e[r]=t(n,r,u)}),e},o.matches=kr,o.max=nr,o.memoize=function(n,t){if(!hr(n))throw new Dr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0]; +return ne.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},o.merge=function(n,t,r){if(!n)return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(a||(t=o.createCallback(t,r,3)),pt(n,function(n,r,u){if(a)for(r=t.length,u=Sr(r);r--;)u[r]=n[t[r]]; +else u=t(n,r,u);f[++e]={a:u,b:e,c:n}}),u=f.length,f.sort(a?l:i);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,r){return t.call(r,n),n},o.throttle=function(n,t,r){var e=true,u=true;if(!hr(n))throw new Dr;return false===r?e=false:gr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,ar(n,t,ft)},o.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Sr(n);for(t=U(t,r,1);++er?ge(0,e+r):ve(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=Or,o.noConflict=function(){return t._=Mr,this},o.noop=Er,o.now=Be,o.pad=function(n,t,r){n=null==n?"":$r(n),t|=0;var e=n.length;return e=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(yr(u)){if(n.slice(o).search(u)){var a,i,l=n.slice(0,o);for(u.global||(u=Pr(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;a=u.exec(l);)i=a.index; +r=r.slice(0,null==i?o:i)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(L,b))},o.uniqueId=function(n){var t=++I;return $r(null==n?"":n)+t},o.all=Xt,o.any=ur,o.detect=Gt,o.findWhere=Gt,o.foldl=tr,o.foldr=rr,o.include=Zt,o.inject=tr,Or(function(){var n={};return _t(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=Ft,o.last=Dt,o.sample=function(n,t,r){return n&&typeof n.length!="number"?n=_r(n):je.unindexedChars&&mr(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0"']/g,F=/<%-([\s\S]+?)%>/g,P=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,K=/($^)/,M=/[.*+?^${}()|[\]\\]/g,V=/\bthis\b/,Z=/['\n\r\t\u2028\u2029\\]/g,X=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,Y=" \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",G="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),H="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),J="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",at="[object RegExp]",it="[object String]",lt={}; lt[et]=false,lt[J]=lt[Q]=lt[nt]=lt[tt]=lt[ut]=lt[ot]=lt[at]=lt[it]=true;var ft={leading:false,maxWait:0,trailing:false},ct={configurable:false,enumerable:false,value:null,writable:false},st={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},ht={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},gt={"function":true,object:true},vt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},yt=gt[typeof window]&&window||this,mt=gt[typeof exports]&&exports&&!exports.nodeType&&exports,gt=gt[typeof module]&&module&&!module.nodeType&&module,dt=mt&>&&typeof global=="object"&&global; !dt||dt.global!==dt&&dt.window!==dt&&dt.self!==dt||(yt=dt);var dt=gt&>.exports===mt&&mt,bt=_();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yt._=bt, define(function(){return bt})):mt&>?dt?(gt.exports=bt)._=bt:mt._=bt:yt._=bt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 0575ba87b..43ac76c61 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -4,7 +4,7 @@ * Build: `lodash modern -o ./dist/lodash.js` * Copyright 2012-2014 The Dojo Foundation * Based on Underscore.js 1.6.0 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ ;(function() { @@ -50,7 +50,7 @@ */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - /** Used to match regexp flags from their coerced string values */ + /** Used to match `RegExp` flags from their coerced string values */ var reFlags = /\w*$/; /** Used to detected named functions */ @@ -66,8 +66,8 @@ var reNoMatch = /($^)/; /** - * Used to match RegExp special characters. - * See this [article on RegExp characters](http://www.regular-expressions.info/characters.html#special) + * Used to match `RegExp` special characters. + * See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special) * for more details. */ var reRegExpChars = /[.*+?^${}()|[\]\\]/g; @@ -100,7 +100,7 @@ 'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError' ]; - /** Used to make template sourceURLs easier to identify */ + /** Used to make template `sourceURL`s easier to identify */ var templateCounter = 0; /** `Object#toString` result shortcuts */ @@ -188,7 +188,7 @@ '\xDF': 'ss', '\xD7': ' ', '\xF7': ' ' }; - /** Used to determine if values are of the language type Object */ + /** Used to determine if values are of the language type `Object` */ var objectTypes = { 'function': true, 'object': true @@ -309,6 +309,7 @@ * * @private * @param {string} string The string to inspect. + * @param {string} chars The chars to find. * @returns {number} Returns the index of the first character not found in `chars`. */ function charsLeftIndex(string, chars) { @@ -328,6 +329,7 @@ * * @private * @param {string} string The string to inspect. + * @param {string} chars The chars to find. * @returns {number} Returns the index of the last character not found in `chars`. */ function charsRightIndex(string, chars) { @@ -341,7 +343,7 @@ } /** - * Used by `sortBy` to compare transformed elements of a collection and stable + * Used by `_.sortBy` to compare transformed elements of a collection and stable * sort them in ascending order. * * @private @@ -354,7 +356,7 @@ } /** - * Used by `sortBy` to compare multiple properties of each element in a + * Used by `_.sortBy` to compare multiple properties of each element in a * collection and stable sort them in ascending order. * * @private @@ -418,7 +420,7 @@ } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. @@ -429,7 +431,7 @@ } /** - * Used by `template` to escape characters for inclusion in compiled + * Used by `_.template` to escape characters for inclusion in compiled * string literals. * * @private @@ -441,7 +443,7 @@ } /** - * A fallback implementation of `trim` to remove leading and trailing + * A fallback implementation of `String#trim` to remove leading and trailing * whitespace or specified characters from `string`. * * @private @@ -462,7 +464,7 @@ } /** - * A fallback implementation of `trimLeft` to remove leading whitespace or + * A fallback implementation of `String#trimLeft` to remove leading whitespace or * specified characters from `string`. * * @private @@ -483,7 +485,7 @@ } /** - * A fallback implementation of `trimRight` to remove trailing whitespace or + * A fallback implementation of `String#trimRight` to remove trailing whitespace or * specified characters from `string`. * * @private @@ -544,7 +546,7 @@ } /** - * Used by `unescape` to convert HTML entities to characters. + * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. @@ -557,7 +559,7 @@ /*--------------------------------------------------------------------------*/ /** - * Create a new `lodash` function using the given context object. + * Create a new `lodash` function using the given `context` object. * * @static * @memberOf _ @@ -592,17 +594,17 @@ /** Used to detect DOM support */ var document = (document = context.window) && document.document; - /** Used to restore the original `_` reference in `noConflict` */ + /** Used to restore the original `_` reference in `_.noConflict` */ var oldDash = context._; /** - * Used as the maximum length an array-like object. + * Used as the maximum length of an array-like object. * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. */ var maxSafeInteger = Math.pow(2, 53) - 1; - /** Used to resolve the internal [[Class]] of values */ + /** Used to resolve the internal `[[Class]]` of values */ var toString = objectProto.toString; /** Used to detect if a method is native */ @@ -624,7 +626,7 @@ splice = arrayRef.splice, unshift = arrayRef.unshift; - /** Used to set meta data on functions */ + /** Used to set metadata on functions */ var defineProperty = (function() { // IE 8 only accepts DOM elements try { @@ -651,7 +653,7 @@ nativeTrimLeft = isNative(nativeTrimLeft = stringProto.trimLeft) && !nativeTrimLeft.call(whitespace) && nativeTrimLeft, nativeTrimRight = isNative(nativeTrimRight = stringProto.trimRight) && !nativeTrimRight.call(whitespace) && nativeTrimRight; - /** Used to lookup a built-in constructor by [[Class]] */ + /** Used to lookup a built-in constructor by `[[Class]]` */ var ctorByClass = {}; ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; @@ -743,7 +745,7 @@ * * @private * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} [chainAll=false] A flag to enable chaining for all methods + * @param {boolean} [chainAll=false] A flag to enable chaining for all methods. * @returns {Object} Returns a `lodash` instance. */ function lodashWrapper(value, chainAll) { @@ -856,7 +858,7 @@ /** * The base implementation of `_.bind` that creates the bound function and - * sets its meta data. + * sets its metadata. * * @private * @param {Array} data The metadata array. @@ -917,7 +919,7 @@ return result; } } - // inspect [[Class]] + // inspect `[[Class]]` var isObj = isObject(value); if (isObj) { var className = toString.call(value); @@ -1071,7 +1073,7 @@ /** * The base implementation of `createWrapper` that creates the wrapper and - * sets its meta data. + * sets its metadata. * * @private * @param {Array} data The metadata array. @@ -1229,7 +1231,7 @@ } /** - * The base implementation of `find`, 'findLast`, `findKey`, and `findLastKey` + * The base implementation of `_.find`, '_.findLast`, `_.findKey`, and `_.findLastKey` * without support for callback shorthands or `this` binding which iterates * over `collection` using the provided `eachFunc`. * @@ -1415,7 +1417,7 @@ (valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object'))) { return false; } - // compare [[Class]] names + // compare `[[Class]]` names var valClass = toString.call(value), othClass = toString.call(other), valIsArg = valClass == argsClass, @@ -1996,7 +1998,7 @@ }; /** - * A fallback implementation of `isPlainObject` which checks if `value` is + * A fallback implementation of `_.isPlainObject` which checks if `value` is * an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and * that there are no `Object.prototype` extensions. @@ -2036,11 +2038,17 @@ var index = -1, props = keysIn(object), length = props.length, + objLength = length && object.length, result = []; + if (typeof objLength == 'number' && objLength > 0) { + var allowIndexes = isArray(object), + maxIndex = objLength - 1; + } while (++index < length) { var key = props[index]; - if (hasOwnProperty.call(object, key)) { + if ((allowIndexes && key > -1 && key <= maxIndex && key % 1 == 0) || + hasOwnProperty.call(object, key)) { result.push(key); } } @@ -2093,8 +2101,8 @@ * _.difference([1, 2, 3], [5, 2, 10]); * // => [1, 3] */ - function difference(array) { - return baseDifference(array, baseFlatten(arguments, true, true, 1)); + function difference() { + return baseDifference(arguments[0], baseFlatten(arguments, true, true, 1)); } /** @@ -2531,46 +2539,43 @@ * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); * // => [1, 2] */ - function intersection(array) { - if (!array) { - return []; - } + function intersection() { var args = [], argsIndex = -1, argsLength = arguments.length, caches = [], indexOf = getIndexOf(), - prereq = createCache && indexOf === baseIndexOf, - seen = []; + prereq = createCache && indexOf === baseIndexOf; while (++argsIndex < argsLength) { var value = arguments[argsIndex]; if (isArray(value) || isArguments(value)) { args.push(value); caches.push(prereq && value.length >= 120 && - createCache(argsIndex ? value : seen)); + createCache(argsIndex && value)); } } argsLength = args.length; var array = args[0], index = -1, length = array ? array.length : 0, - result = []; + result = [], + seen = caches[0]; outer: while (++index < length) { - var cache = caches[0]; value = array[index]; - - if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value)) < 0) { argsIndex = argsLength; - (cache || seen).push(value); while (--argsIndex) { - cache = caches[argsIndex]; + var cache = caches[argsIndex]; if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } + if (seen) { + seen.push(value); + } result.push(value); } } @@ -3248,9 +3253,7 @@ * // => 'pebbles is 1' */ function chain(value) { - value = new lodashWrapper(value); - value.__chain__ = true; - return value; + return new lodashWrapper(value, true); } /** @@ -4726,7 +4729,7 @@ * @static * @memberOf _ * @category Functions - * @param {...Function} [func] Functions to compose. + * @param {...Function} [funcs] Functions to compose. * @returns {Function} Returns the new composed function. * @example * @@ -4812,7 +4815,7 @@ * the leading and/or trailing edge of the `wait` timeout. Subsequent calls * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true` `func` will be called + * Note: If `leading` and `trailing` options are `true`, `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -5188,7 +5191,7 @@ * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true` `func` will be called + * Note: If `leading` and `trailing` options are `true`, `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -6056,7 +6059,7 @@ } /** - * Checks if `value` is the language type of Object. + * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -6076,7 +6079,7 @@ * // => false */ function isObject(value) { - // check if the value is the ECMAScript language type of Object + // check if the value is the ECMAScript language type of `Object` // http://es5.github.io/#x8 // and avoid a V8 bug // https://code.google.com/p/v8/issues/detail?id=2291 @@ -6112,7 +6115,7 @@ */ function isNaN(value) { // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) + // (perform the `[[Class]]` check first to avoid errors with some host objects in IE) return isNumber(value) && value != +value; } @@ -6282,6 +6285,10 @@ * // => ['x', 'y'] (property order is not guaranteed across environments) */ var keys = !nativeKeys ? shimKeys : function(object) { + var length = object ? object.length : 0; + if (typeof length == 'number' && length > 0) { + return shimKeys(object); + } return isObject(object) ? nativeKeys(object) : []; }; @@ -6306,12 +6313,24 @@ * // => ['x', 'y', 'z'] (property order is not guaranteed across environments) */ function keysIn(object) { - var result = []; if (!isObject(object)) { - return result; + return []; + } + var length = isArray(object) ? object.length : 0, + maxIndex = length - 1, + result = Array(length), + skipIndexes = length > 0; + + if (skipIndexes) { + var index = -1; + while (++index < length) { + result[index] = String(index); + } } for (var key in object) { - result.push(key); + if (!(skipIndexes && key > -1 && key <= maxIndex && key % 1 == 0)) { + result.push(key); + } } return result; } @@ -6767,7 +6786,7 @@ } /** - * Escapes the RegExp special characters "\", "^", "$", ".", "|", "?", "*", + * Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*", * "+", "(", ")", "[", "]", "{" and "}" in `string`. * * @static @@ -7003,7 +7022,7 @@ * settings object is provided it will override `_.templateSettings` for the * template. * - * Note: In the development build, `_.template` utilizes sourceURLs for easier debugging. + * Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * @@ -7023,7 +7042,7 @@ * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as local variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. + * @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @returns {Function|string} Returns the interpolated string if a data object * is provided, else the compiled template function. @@ -7061,7 +7080,7 @@ * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); * // => '
  • fred
  • barney
  • ' * - * // using the `sourceURL` option to specify a custom sourceURL for the template + * // using the `sourceURL` option to specify a custom `sourceURL` for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector @@ -7167,7 +7186,7 @@ source + 'return __p\n}'; - // Use a sourceURL for easier debugging. + // Use a `sourceURL` for easier debugging. // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; @@ -7267,7 +7286,7 @@ * @static * @memberOf _ * @category Strings - * @param {string} [string=''] The string to trim. + * @param {string} [string=''] The string to truncate. * @param {Object|number} [options] The options object or maximum string length. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string used to indicate text is omitted. @@ -7637,7 +7656,7 @@ /** * Converts `value` to an integer of the specified radix. If `radix` is - * `undefined` or `0` a `radix` of `10` is used unless `value` is a hexadecimal, + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, * in which case a `radix` of `16` is used. * * Note: This method avoids differences in native ES3 and ES5 `parseInt` diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 07bd3ca47..cca3014d3 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -18,47 +18,48 @@ case et:case ut:return n==Wr(t)}if(a=f==H,!a){var p=Yr.call(n,"__wrapped__"),s=Y n[o]=f})}function wt(n,t){return n+Vr(se()*(t-n+1))}function xt(n,t,u){var o=n?n.length:0;if(!o)return[];var i=-1,a=It(),l=!t&&a===r,f=l&&be&&200<=o,l=l&&!f,c=[];if(f)var p=be(),a=e;else p=u&&!t?[]:c;n:for(;++ia(p,h)&&((u||f)&&p.push(h),c.push(s))}return c}function kt(n,t){for(var r=-1,e=t(n),u=e.length,o=Or(u);++rr&&(r=0),p&&(i=[]),s&&(a=[]),h=[n,t,r,e,u,o,i,a],t==w||t==(w|C)?c(h):Z(h))}function It(){var n=(n=o.indexOf)===Wt?r:n;return n}function Et(n){return typeof n=="function"&&Pr.test(Zr.call(n))}function Rt(n){var t,r;return n&&Ur.call(n)==rt&&(Yr.call(n,"constructor")||(t=n.constructor,!cr(t)||t instanceof t))?(gt(n,function(n,t){r=t -},vr),typeof r=="undefined"||Yr.call(n,r)):false}function Nt(n){for(var t=-1,r=vr(n),e=r.length,u=[];++ti?0:i)}function Wt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?le(0,u+e):e||0; -else if(e)return e=zt(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Ft(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++}else i=null==t||r?1:t;return i=e-i,Lt(n,0,0>i?0:i)}function $t(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++}else if(i=t,null==i||r)return n?n[e-1]:_;return i=e-i,Lt(n,0>i?0:i)}function Dt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,i=0; -for(t=o.createCallback(t,r,3);++et?0:t;return Lt(n,i)}function Lt(n,t,r){var e=-1,u=n?n.length:0;for(t=+t||0,0>t?t=le(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=le(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Or(u);++e>>1,r(n[e])r?0:r);++tr?le(0,e+r):r,-1i&&(i=l)}else t=null==t&&gr(n)?u:o.createCallback(t,r,3),ft(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,i=n)});return i}function Jt(n,t,r,e){var u=3>arguments.length;t=o.createCallback(t,e,4);var i=-1,a=n?n.length:0; -if(typeof a=="number"&&-1arguments.length;return t=o.createCallback(t,e,4),ct(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function nr(n){var t=-1,r=n&&n.length,e=Or(0>r?0:r>>>0);return ft(n,function(n){var r=wt(0,++t);e[t]=e[r],e[r]=n}),e}function tr(n,t,r){var e;t=o.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return At(n,w,null,t);if(n)var r=n[I]?n[I][2]:n.length,e=Lt(arguments,2),r=r-e.length;return At(n,w|C,r,t,e)}function er(n,t,r){var e,u,o,i,a,l,f,c=0,p=false,s=true;if(!cr(n))throw new Fr;if(t=0>t?0:t,true===r)var h=true,s=false;else pr(r)&&(h=r.leading,p="maxWait"in r&&(le(t,r.maxWait)||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(Fe()-i);0>=r||r>t?(u&&Mr(u),r=f,u=l=f=_,r&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))):l=Jr(g,r) -},v=function(){l&&Mr(l),u=l=f=_,(s||p!==t)&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Fe(),a=this,f=s&&(l||!h),false===p)var r=h&&!l;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=Mr(u)),c=i,o=n.apply(a,e)):u||(u=Jr(v,y))}return m&&l?l=Mr(l):l||t===p||(l=Jr(g,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o}}function ur(n){if(!cr(n))throw new Fr;return function(){return!n.apply(this,arguments)}}function or(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,i=typeof r; -if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3arguments.length)return t;var r=Lt(arguments);return r.push(n),or.apply(null,r)}function ar(n){var t=[];return gt(n,function(n,r){cr(n)&&t.push(r)},vr),t.sort()}function lr(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ur.call(n)==G||false -}function fr(n){return n&&typeof n=="object"&&1===n.nodeType&&-1t||null==n)return r;n=Wr(n);do t%2&&(r+=n),t=Vr(t/2),n+=n;while(t);return r}function _r(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||U(n,t,r):"object"!=e?Cr(n):xr(n) -}function wr(n){return n}function xr(n){n||(n={});var t=Ie(n),r=t.length,e=t[0],u=n[e];return 1!=r||u!==u||pr(u)?function(e){for(var u=r,o=false;u--&&(o=t[u],o=Yr.call(e,o)&&bt(e[o],n[o],null,true)););return o}:function(n){return Yr.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function kr(n,t,r){var e=true,u=t&&ar(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=o,u=ar(t)),false===r?e=false:pr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var i=cr(n),a=u?u.length:0;++ri?0:i)}function Wt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?le(0,u+e):e||0;else if(e)return e=zt(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Ft(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++}else i=null==t||r?1:t;return i=e-i,Lt(n,0,0>i?0:i)}function $t(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++}else if(i=t,null==i||r)return n?n[e-1]:_; +return i=e-i,Lt(n,0>i?0:i)}function Dt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,i=0;for(t=o.createCallback(t,r,3);++et?0:t;return Lt(n,i)}function Lt(n,t,r){var e=-1,u=n?n.length:0;for(t=+t||0,0>t?t=le(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=le(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Or(u);++e>>1,r(n[e])r?0:r);++tr?le(0,e+r):r,-1i&&(i=l)}else t=null==t&&gr(n)?u:o.createCallback(t,r,3),ft(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,i=n)});return i}function Jt(n,t,r,e){var u=3>arguments.length;t=o.createCallback(t,e,4);var i=-1,a=n?n.length:0;if(typeof a=="number"&&-1arguments.length;return t=o.createCallback(t,e,4),ct(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function nr(n){var t=-1,r=n&&n.length,e=Or(0>r?0:r>>>0); +return ft(n,function(n){var r=wt(0,++t);e[t]=e[r],e[r]=n}),e}function tr(n,t,r){var e;t=o.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return At(n,w,null,t);if(n)var r=n[I]?n[I][2]:n.length,e=Lt(arguments,2),r=r-e.length;return At(n,w|C,r,t,e)}function er(n,t,r){var e,u,o,i,a,l,f,c=0,p=false,s=true;if(!cr(n))throw new Fr;if(t=0>t?0:t,true===r)var h=true,s=false; +else pr(r)&&(h=r.leading,p="maxWait"in r&&(le(t,r.maxWait)||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(Fe()-i);0>=r||r>t?(u&&Mr(u),r=f,u=l=f=_,r&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))):l=Jr(g,r)},v=function(){l&&Mr(l),u=l=f=_,(s||p!==t)&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Fe(),a=this,f=s&&(l||!h),false===p)var r=h&&!l;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=Mr(u)),c=i,o=n.apply(a,e)):u||(u=Jr(v,y))}return m&&l?l=Mr(l):l||t===p||(l=Jr(g,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o +}}function ur(n){if(!cr(n))throw new Fr;return function(){return!n.apply(this,arguments)}}function or(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3arguments.length)return t;var r=Lt(arguments); +return r.push(n),or.apply(null,r)}function ar(n){var t=[];return gt(n,function(n,r){cr(n)&&t.push(r)},vr),t.sort()}function lr(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ur.call(n)==G||false}function fr(n){return n&&typeof n=="object"&&1===n.nodeType&&-1t||null==n)return r;n=Wr(n);do t%2&&(r+=n),t=Vr(t/2),n+=n;while(t);return r}function _r(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||U(n,t,r):"object"!=e?Cr(n):xr(n)}function wr(n){return n}function xr(n){n||(n={});var t=Ie(n),r=t.length,e=t[0],u=n[e];return 1!=r||u!==u||pr(u)?function(e){for(var u=r,o=false;u--&&(o=t[u],o=Yr.call(e,o)&&bt(e[o],n[o],null,true)););return o +}:function(n){return Yr.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function kr(n,t,r){var e=true,u=t&&ar(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=o,u=ar(t)),false===r?e=false:pr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var i=cr(n),a=u?u.length:0;++r--n?t.apply(this,arguments):void 0 -}},o.assign=or,o.at=function(n,t){var r=arguments,e=-1,u=st(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),r=Or(o);++earguments.length?At(t,w|x,null,n):At(t,w|x|C,null,n,Lt(arguments,2))},o.chain=function(n){return n=new i(n),n.__chain__=true,n -},o.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(h?e(h,c):a(f,c))){for(u=o,(h||f).push(c);--u;)if(h=i[u],0>(h?e(h,c):a(t[u],c)))continue n;s.push(c)}}return s},o.invert=function(n,t){for(var r=-1,e=Ie(n),u=e.length,o={};++ro?0:o>>>0); -return ft(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):_}),i},o.keys=Ie,o.keysIn=vr,o.map=Gt,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),mt(n,function(n,r,u){e[r]=t(n,r,u)}),e},o.matches=xr,o.max=Ht,o.memoize=function(n,t){if(!cr(n))throw new Fr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return Yr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},o.merge=function(n,t,r){if(!n)return n;var e=arguments,u=e.length,o=typeof r; -if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(i||(t=o.createCallback(t,r,3)),ft(n,function(n,r,u){if(i)for(r=t.length,u=Or(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);f[++e]={a:u,b:e,c:n}}),u=f.length,f.sort(i?l:a);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,r){return t.call(r,n),n},o.throttle=function(n,t,r){var e=true,u=true;if(!cr(n))throw new Fr; -return false===r?e=false:pr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),it.leading=e,it.maxWait=+t,it.trailing=u,er(n,t,it)},o.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Or(n);for(t=U(t,r,1);++er?le(0,e+r):fe(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=kr,o.noConflict=function(){return t._=Br,this},o.noop=jr,o.now=Fe,o.pad=function(n,t,r){n=null==n?"":Wr(n),t|=0;var e=n.length;return e=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(hr(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Tr(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index; -r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,d))},o.uniqueId=function(n){var t=++E;return Wr(null==n?"":n)+t},o.all=Mt,o.any=tr,o.detect=Zt,o.findWhere=Zt,o.foldl=Jt,o.foldr=Qt,o.include=Kt,o.inject=Jt,kr(function(){var n={};return mt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=Tt,o.last=$t,o.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=mr(n)),null==t||r?(t=n?n.length:0,0"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,D=/<%=([\s\S]+?)%>/g,L=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,P=/($^)/,K=/[.*+?^${}()|[\]\\]/g,M=/\bthis\b/,V=/['\n\r\t\u2028\u2029\\]/g,Z=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,X=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Y="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",Q="[object Date]",nt="[object Function]",tt="[object Number]",rt="[object Object]",et="[object RegExp]",ut="[object String]",ot={}; +}},o.assign=or,o.at=function(n,t){var r=arguments,e=-1,u=st(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),r=Or(o);++earguments.length?At(t,w|x,null,n):At(t,w|x|C,null,n,Lt(arguments,2))},o.chain=function(n){return new i(n,true)},o.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(s?e(s,l):i(p,l))){for(t=u;--t;){var h=o[t]; +if(0>(h?e(h,l):i(n[t],l)))continue n}s&&s.push(l),p.push(l)}return p},o.invert=function(n,t){for(var r=-1,e=Ie(n),u=e.length,o={};++ro?0:o>>>0);return ft(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):_}),i},o.keys=Ie,o.keysIn=vr,o.map=Gt,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),mt(n,function(n,r,u){e[r]=t(n,r,u) +}),e},o.matches=xr,o.max=Ht,o.memoize=function(n,t){if(!cr(n))throw new Fr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return Yr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},o.merge=function(n,t,r){if(!n)return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(i||(t=o.createCallback(t,r,3)),ft(n,function(n,r,u){if(i)for(r=t.length,u=Or(r);r--;)u[r]=n[t[r]]; +else u=t(n,r,u);f[++e]={a:u,b:e,c:n}}),u=f.length,f.sort(i?l:a);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,r){return t.call(r,n),n},o.throttle=function(n,t,r){var e=true,u=true;if(!cr(n))throw new Fr;return false===r?e=false:pr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),it.leading=e,it.maxWait=+t,it.trailing=u,er(n,t,it)},o.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Or(n);for(t=U(t,r,1);++er?le(0,e+r):fe(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=kr,o.noConflict=function(){return t._=Br,this},o.noop=jr,o.now=Fe,o.pad=function(n,t,r){n=null==n?"":Wr(n),t|=0;var e=n.length;return e=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(hr(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Tr(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,d))},o.uniqueId=function(n){var t=++E; +return Wr(null==n?"":n)+t},o.all=Mt,o.any=tr,o.detect=Zt,o.findWhere=Zt,o.foldl=Jt,o.foldr=Qt,o.include=Kt,o.inject=Jt,kr(function(){var n={};return mt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=Tt,o.last=$t,o.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=mr(n)),null==t||r?(t=n?n.length:0,0"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,D=/<%=([\s\S]+?)%>/g,L=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,P=/($^)/,K=/[.*+?^${}()|[\]\\]/g,M=/\bthis\b/,V=/['\n\r\t\u2028\u2029\\]/g,Z=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,X=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Y="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",Q="[object Date]",nt="[object Function]",tt="[object Number]",rt="[object Object]",et="[object RegExp]",ut="[object String]",ot={}; ot[nt]=false,ot[G]=ot[H]=ot[J]=ot[Q]=ot[tt]=ot[rt]=ot[et]=ot[ut]=true;var it={leading:false,maxWait:0,trailing:false},at={configurable:false,enumerable:false,value:null,writable:false},lt={"&":"&","<":"<",">":">",'"':""","'":"'"},ft={"&":"&","<":"<",">":">",""":'"',"'":"'"},ct={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},pt={"function":true,object:true},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ht=pt[typeof window]&&window||this,gt=pt[typeof exports]&&exports&&!exports.nodeType&&exports,pt=pt[typeof module]&&module&&!module.nodeType&&module,vt=gt&&pt&&typeof global=="object"&&global; !vt||vt.global!==vt&&vt.window!==vt&&vt.self!==vt||(ht=vt);var vt=pt&&pt.exports===gt&>,yt=b();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ht._=yt, define(function(){return yt})):gt&&pt?vt?(pt.exports=yt)._=yt:gt._=yt:ht._=yt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index f16b2f735..e6f0d2545 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -4,7 +4,7 @@ * Build: `lodash underscore -o ./dist/lodash.underscore.js` * Copyright 2012-2014 The Dojo Foundation * Based on Underscore.js 1.6.0 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ ;(function() { @@ -45,8 +45,8 @@ var reNoMatch = /($^)/; /** - * Used to match RegExp special characters. - * See this [article on RegExp characters](http://www.regular-expressions.info/characters.html#special) + * Used to match `RegExp` special characters. + * See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special) * for more details. */ var reRegExpChars = /[.*+?^${}()|[\]\\]/g; @@ -91,7 +91,7 @@ ''': "'" }; - /** Used to determine if values are of the language type Object */ + /** Used to determine if values are of the language type `Object` */ var objectTypes = { 'function': true, 'object': true @@ -171,7 +171,7 @@ } /** - * Used by `sortBy` to compare transformed elements of a collection and stable + * Used by `_.sortBy` to compare transformed elements of a collection and stable * sort them in ascending order. * * @private @@ -184,7 +184,7 @@ } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. @@ -195,7 +195,7 @@ } /** - * Used by `template` to escape characters for inclusion in compiled + * Used by `_.template` to escape characters for inclusion in compiled * string literals. * * @private @@ -207,7 +207,7 @@ } /** - * Used by `unescape` to convert HTML entities to characters. + * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. @@ -223,17 +223,17 @@ var arrayRef = Array.prototype, objectProto = Object.prototype; - /** Used to restore the original `_` reference in `noConflict` */ + /** Used to restore the original `_` reference in `_.noConflict` */ var oldDash = root._; /** - * Used as the maximum length an array-like object. + * Used as the maximum length of an array-like object. * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. */ var maxSafeInteger = Math.pow(2, 53) - 1; - /** Used to resolve the internal [[Class]] of values */ + /** Used to resolve the internal `[[Class]]` of values */ var toString = objectProto.toString; /** Used to detect if a method is native */ @@ -342,7 +342,7 @@ * * @private * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} [chainAll=false] A flag to enable chaining for all methods + * @param {boolean} [chainAll=false] A flag to enable chaining for all methods. * @returns {Object} Returns a `lodash` instance. */ function lodashWrapper(value, chainAll) { @@ -488,7 +488,7 @@ /** * The base implementation of `createWrapper` that creates the wrapper and - * sets its meta data. + * sets its metadata. * * @private * @param {Array} data The metadata array. @@ -611,7 +611,7 @@ } /** - * The base implementation of `find`, 'findLast`, `findKey`, and `findLastKey` + * The base implementation of `_.find`, '_.findLast`, `_.findKey`, and `_.findLastKey` * without support for callback shorthands or `this` binding which iterates * over `collection` using the provided `eachFunc`. * @@ -1182,8 +1182,8 @@ * _.difference([1, 2, 3], [5, 2, 10]); * // => [1, 3] */ - function difference(array) { - return baseDifference(array, baseFlatten(arguments, true, true, 1)); + function difference() { + return baseDifference(arguments[0], baseFlatten(arguments, true, true, 1)); } /** @@ -1431,7 +1431,7 @@ args.push(value); } } - argsLength = args.length + argsLength = args.length; var array = args[0], index = -1, indexOf = getIndexOf(), @@ -1873,9 +1873,7 @@ * // => 'pebbles is 1' */ function chain(value) { - value = new lodashWrapper(value); - value.__chain__ = true; - return value; + return new lodashWrapper(value, true); } /** @@ -3165,7 +3163,7 @@ * @static * @memberOf _ * @category Functions - * @param {...Function} [func] Functions to compose. + * @param {...Function} [funcs] Functions to compose. * @returns {Function} Returns the new composed function. * @example * @@ -3214,7 +3212,7 @@ * the leading and/or trailing edge of the `wait` timeout. Subsequent calls * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true` `func` will be called + * Note: If `leading` and `trailing` options are `true`, `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -3538,7 +3536,7 @@ * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true` `func` will be called + * Note: If `leading` and `trailing` options are `true`, `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -3853,7 +3851,7 @@ return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == argsClass || false; } - // fallback for environments that can't detect `arguments` objects by [[Class]] + // fallback for environments that can't detect `arguments` objects by `[[Class]]` if (!isArguments(arguments)) { isArguments = function(value) { return value && typeof value == 'object' && typeof value.length == 'number' && @@ -4083,7 +4081,7 @@ } /** - * Checks if `value` is the language type of Object. + * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -4103,7 +4101,7 @@ * // => false */ function isObject(value) { - // check if the value is the ECMAScript language type of Object + // check if the value is the ECMAScript language type of `Object` // http://es5.github.io/#x8 // and avoid a V8 bug // https://code.google.com/p/v8/issues/detail?id=2291 @@ -4139,7 +4137,7 @@ */ function isNaN(value) { // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) + // (perform the `[[Class]]` check first to avoid errors with some host objects in IE) return isNumber(value) && value != +value; } @@ -4467,7 +4465,7 @@ } /** - * Escapes the RegExp special characters "\", "^", "$", ".", "|", "?", "*", + * Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*", * "+", "(", ")", "[", "]", "{" and "}" in `string`. * * @static @@ -4493,7 +4491,7 @@ * settings object is provided it will override `_.templateSettings` for the * template. * - * Note: In the development build, `_.template` utilizes sourceURLs for easier debugging. + * Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * @@ -4513,7 +4511,7 @@ * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as local variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. + * @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @returns {Function|string} Returns the interpolated string if a data object * is provided, else the compiled template function. @@ -4551,7 +4549,7 @@ * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); * // => '
  • fred
  • barney
  • ' * - * // using the `sourceURL` option to specify a custom sourceURL for the template + * // using the `sourceURL` option to specify a custom `sourceURL` for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 8fb71b493..f765d2c02 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,37 +4,37 @@ * Build: `lodash underscore -o ./dist/lodash.underscore.js` */ ;(function(){function n(n,r,t){t=(+t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(tu(r,i)&&o.push(i)}return o}function p(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number"&&-1u(r,i)&&o.push(i)}return o}function p(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number"&&-1o(f,c)&&(t&&f.push(c),i.push(a)) -}return i}function _(n,r){return function(t,e,u){var o=r?[[],[]]:{};e=nr(e,u,3),u=-1;var i=t?t.length:0;if(typeof i=="number"&&-1r?0:r)}function A(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?Qr(0,u+e):e||0;else if(e)return e=O(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function T(n,r,t){return E(n,null==r||t?1:0>r?0:r)}function E(n,r,t){var e=-1,u=n?n.length:0;for(r=+r||0,0>r?r=Qr(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=Qr(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1,t(n[e])u&&(u=t);else r=nr(r,t,3),p(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function $(n,r,t,e){var u=3>arguments.length;r=nr(r,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return r=nr(r,e,4),s(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function D(n){var r=-1,t=n&&n.length,e=Array(0>t?0:t>>>0); -return p(n,function(n){var t;t=++r,t=0+Wr(Zr()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function W(n,r,t){var e;r=nr(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length?b(n,ir,null,r):b(n,ir|fr,null,r,E(arguments,2))}function C(n,r,t){var e,u,o,i,f,a,c,l=0,p=false,s=true;if(!J(n))throw new TypeError;if(r=0>r?0:r,true===t)var h=true,s=false;else K(t)&&(h=t.leading,p="maxWait"in t&&(Qr(r,t.maxWait)||0),s="trailing"in t?t.trailing:s); -var g=function(){var t=r-(lt()-i);0>=t||t>r?(u&&clearTimeout(u),t=c,u=a=c=or,t&&(l=lt(),o=n.apply(f,e),a||u||(e=f=null))):a=setTimeout(g,t)},v=function(){a&&clearTimeout(a),u=a=c=or,(s||p!==r)&&(l=lt(),o=n.apply(f,e),a||u||(e=f=null))};return function(){if(e=arguments,i=lt(),f=this,c=s&&(a||!h),false===p)var t=h&&!a;else{u||h||(l=i);var y=p-(i-l),m=0>=y||y>p;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(g,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o +return p(n,function(n){var t;t=++r,t=0+Wr(Zr()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function W(n,r,t){var e;r=nr(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length?_(n,ir,null,r):_(n,ir|fr,null,r,E(arguments,2))}function C(n,r,t){var e,u,o,i,f,a,c,l=0,p=false,s=true;if(!J(n))throw new TypeError;if(r=0>r?0:r,true===t)var g=true,s=false;else K(t)&&(g=t.leading,p="maxWait"in t&&(Qr(r,t.maxWait)||0),s="trailing"in t?t.trailing:s); +var h=function(){var t=r-(lt()-i);0>=t||t>r?(u&&clearTimeout(u),t=c,u=a=c=or,t&&(l=lt(),o=n.apply(f,e),a||u||(e=f=null))):a=setTimeout(h,t)},v=function(){a&&clearTimeout(a),u=a=c=or,(s||p!==r)&&(l=lt(),o=n.apply(f,e),a||u||(e=f=null))};return function(){if(e=arguments,i=lt(),f=this,c=s&&(a||!g),false===p)var t=g&&!a;else{u||g||(l=i);var y=p-(i-l),m=0>=y||y>p;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o }}function P(n){if(!J(n))throw new TypeError;return function(){return!n.apply(this,arguments)}}function U(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t;for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,sr=/($^)/,hr=/[.*+?^${}()|[\]\\]/g,gr=/['\n\r\t\u2028\u2029\\]/g,vr="[object Arguments]",yr="[object Array]",mr="[object Boolean]",_r="[object Date]",br="[object Number]",dr="[object Object]",wr="[object RegExp]",jr="[object String]",xr={"&":"&","<":"<",">":">",'"':""","'":"'"},Ar={"&":"&","<":"<",">":">",""":'"',"'":"'"},Tr={"function":true,object:true},Er={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Or=Tr[typeof window]&&window||this,Sr=Tr[typeof exports]&&exports&&!exports.nodeType&&exports,kr=Tr[typeof module]&&module&&!module.nodeType&&module,Nr=Sr&&kr&&typeof global=="object"&&global; -!Nr||Nr.global!==Nr&&Nr.window!==Nr&&Nr.self!==Nr||(Or=Nr);var qr=kr&&kr.exports===Sr&&Sr,Fr=Array.prototype,Br=Object.prototype,Mr=Or._,Rr=Math.pow(2,53)-1,$r=Br.toString,Ir=RegExp("^"+(null==$r?"":($r+"").replace(hr,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Dr=Math.ceil,Wr=Math.floor,zr=Function.prototype.toString,Cr=Br.hasOwnProperty,Pr=Fr.push,Ur=Br.propertyIsEnumerable,Vr=Fr.splice,Gr=w(Gr=Object.create)&&Gr,Hr=w(Hr=Array.isArray)&&Hr,Jr=Or.isFinite,Kr=Or.isNaN,Lr=w(Lr=Object.keys)&&Lr,Qr=Math.max,Xr=Math.min,Yr=w(Yr=Date.now)&&Yr,Zr=Math.random; -i.prototype=o.prototype;var nt={};!function(){var n={0:1,length:1};nt.spliceObjects=(Vr.call(n,0,1),!n[0])}(1),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Gr||(f=function(){function n(){}return function(r){if(K(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Or.Object()}}());var rt=T,tt=_(function(n,r,t){Cr.call(n,t)?n[t]++:n[t]=1}),et=_(function(n,r,t){Cr.call(n,t)?n[t].push(r):n[t]=[r]}),ut=_(function(n,r,t){n[t]=r -}),ot=_(function(n,r,t){n[t?0:1].push(r)},true),it=M,ft=q;H(arguments)||(H=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Cr.call(n,"callee")&&!Ur.call(n,"callee")||false});var at=Hr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&$r.call(n)==yr||false};J(/x/)&&(J=function(n){return typeof n=="function"&&"[object Function]"==$r.call(n)});var ct=Lr?function(n){return K(n)?Lr(n):[]}:j,lt=Yr||function(){return(new Date).getTime()};o.after=function(n,r){if(!J(r))throw new TypeError; -return function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=z,o.bindAll=function(n){for(var r=1"']/g,sr=/($^)/,gr=/[.*+?^${}()|[\]\\]/g,hr=/['\n\r\t\u2028\u2029\\]/g,vr="[object Arguments]",yr="[object Array]",mr="[object Boolean]",br="[object Date]",_r="[object Number]",dr="[object Object]",wr="[object RegExp]",jr="[object String]",xr={"&":"&","<":"<",">":">",'"':""","'":"'"},Ar={"&":"&","<":"<",">":">",""":'"',"'":"'"},Tr={"function":true,object:true},Er={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Or=Tr[typeof window]&&window||this,Sr=Tr[typeof exports]&&exports&&!exports.nodeType&&exports,kr=Tr[typeof module]&&module&&!module.nodeType&&module,Nr=Sr&&kr&&typeof global=="object"&&global; +!Nr||Nr.global!==Nr&&Nr.window!==Nr&&Nr.self!==Nr||(Or=Nr);var qr=kr&&kr.exports===Sr&&Sr,Fr=Array.prototype,Br=Object.prototype,Mr=Or._,Rr=Math.pow(2,53)-1,$r=Br.toString,Ir=RegExp("^"+(null==$r?"":($r+"").replace(gr,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Dr=Math.ceil,Wr=Math.floor,zr=Function.prototype.toString,Cr=Br.hasOwnProperty,Pr=Fr.push,Ur=Br.propertyIsEnumerable,Vr=Fr.splice,Gr=w(Gr=Object.create)&&Gr,Hr=w(Hr=Array.isArray)&&Hr,Jr=Or.isFinite,Kr=Or.isNaN,Lr=w(Lr=Object.keys)&&Lr,Qr=Math.max,Xr=Math.min,Yr=w(Yr=Date.now)&&Yr,Zr=Math.random; +i.prototype=o.prototype;var nt={};!function(){var n={0:1,length:1};nt.spliceObjects=(Vr.call(n,0,1),!n[0])}(1),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Gr||(f=function(){function n(){}return function(r){if(K(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Or.Object()}}());var rt=T,tt=b(function(n,r,t){Cr.call(n,t)?n[t]++:n[t]=1}),et=b(function(n,r,t){Cr.call(n,t)?n[t].push(r):n[t]=[r]}),ut=b(function(n,r,t){n[t]=r +}),ot=b(function(n,r,t){n[t?0:1].push(r)},true),it=M,ft=q;H(arguments)||(H=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Cr.call(n,"callee")&&!Ur.call(n,"callee")||false});var at=Hr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&$r.call(n)==yr||false};J(/x/)&&(J=function(n){return typeof n=="function"&&"[object Function]"==$r.call(n)});var ct=Lr?function(n){return K(n)?Lr(n):[]}:j,lt=Yr||function(){return(new Date).getTime()};o.after=function(n,r){if(!J(r))throw new TypeError; +return function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=z,o.bindAll=function(n){for(var r=1r?0:r)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=ct(n),e=t.length,u={};++ro?0:o>>>0); return p(n,function(n){var o=u?r:null!=n&&n[r];i[++e]=o?o.apply(n,t):or}),i},o.keys=ct,o.map=M,o.matches=tr,o.max=R,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):"_"+arguments[0];return Cr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number"&&-1o?0:o>>>0);for(t=nr(t,e,3),p(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!J(n))throw new TypeError;return false===t?e=false:K(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),C(n,r,{leading:e,maxWait:r,trailing:u}) -},o.times=function(n,r,t){n=-1<(n=+n)?n:0;var e=-1,u=Array(n);for(r=a(r,t,1);++er?0:r);++nr?0:r);++nt?Qr(0,e+t):Xr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=er,o.noConflict=function(){return Or._=Mr,this},o.now=lt,o.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Wr(Zr()*(r-n+1))},o.reduce=$,o.reduceRight=I,o.result=function(n,r){if(null!=n){var t=n[r];return J(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"&&-1n.indexOf(";")?n:n.replace(lr,u))},o.uniqueId=function(n){var r=++cr+"";return n?n+r:r},o.all=N,o.any=W,o.detect=F,o.findWhere=F,o.foldl=$,o.foldr=I,o.include=k,o.inject=$,o.first=x,o.last=function(n,r,t){var e=n?n.length:0;return null==r||t?n?n[e-1]:or:(r=e-r,E(n,0>r?0:r))},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=Z(n)),null==r||t?(r=n?n.length:0,0