From dee5f4c96afe46aee2a7b95b648dd18be6c89cec Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 31 Mar 2014 23:56:37 -0700 Subject: [PATCH] Rebuild dist. --- dist/lodash.compat.js | 141 +++++++++++++++++++--------------- dist/lodash.compat.min.js | 128 +++++++++++++++--------------- dist/lodash.js | 115 ++++++++++++++------------- dist/lodash.min.js | 120 ++++++++++++++--------------- dist/lodash.underscore.js | 41 +++++----- dist/lodash.underscore.min.js | 70 ++++++++--------- 6 files changed, 319 insertions(+), 296 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 9cc32cc8e..ced5c4512 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -29,6 +29,9 @@ /** Used to generate unique IDs */ var idCounter = 0; + /** Used to detect words composed of all capital letters */ + var reAllCaps = /^[A-Z]+$/; + /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -76,10 +79,10 @@ var reThis = /\bthis\b/; /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to match words to create compound words */ - var reWords = /[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g; + var reWords = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g; /** Used to detect and test whitespace */ var whitespace = ( @@ -207,7 +210,6 @@ "'": "'", '\n': 'n', '\r': 'r', - '\t': 't', '\u2028': 'u2028', '\u2029': 'u2029' }; @@ -275,7 +277,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - var index = (+fromIndex || 0) - 1, + var index = (fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { @@ -813,7 +815,8 @@ ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new ctor) { props.push(key); } - for (key in arguments) { } + for (var argsKey in arguments) { } + for (var strKey in 'x') { } /** * Detect if an `arguments` object's `[[Class]]` is resolvable (all but Firefox < 4, IE < 9). @@ -833,7 +836,7 @@ /** * Detect if `name` or `message` properties of `Error.prototype` are - * enumerable by default. (IE < 9, Safari < 5.1) + * enumerable by default (IE < 9, Safari < 5.1). * * @memberOf _.support * @type boolean @@ -877,7 +880,15 @@ * @memberOf _.support * @type boolean */ - support.nonEnumArgs = key != '0'; + support.nonEnumArgs = argsKey != '0'; + + /** + * Detect if string indexes are non-enumerable (IE < 9, RingoJS, Rhino, Narwhal). + * + * @memberOf _.support + * @type boolean + */ + support.nonEnumStrings = strKey != '0'; /** * Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -1104,7 +1115,6 @@ var isArr = isArray(value); if (isDeep) { // check for circular references and return corresponding clone - var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); @@ -1266,14 +1276,19 @@ if (partialRightArgs) { args = composeArgsRight(partialRightArgs, partialRightHolders, args); } - if (isCurry && length < arity) { - bitmask |= PARTIAL_FLAG; - bitmask &= ~PARTIAL_RIGHT_FLAG - if (!isCurryBound) { - bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + if (isCurry) { + var newPartialHolders = []; + length -= newPartialHolders.length; + + if (length < arity) { + bitmask |= PARTIAL_FLAG; + bitmask &= ~PARTIAL_RIGHT_FLAG + if (!isCurryBound) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + var newArity = nativeMax(arity - length, 0); + return baseCreateWrapper([func, bitmask, newArity, thisArg, args, null, newPartialHolders]); } - var newArity = nativeMax(0, arity - length); - return baseCreateWrapper([func, bitmask, newArity, thisArg, args, null, []]); } var thisBinding = isBind ? thisArg : this; if (isBindKey) { @@ -1430,7 +1445,7 @@ * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (+fromIndex || 0) - 1, + var index = (fromIndex || 0) - 1, length = array ? array.length : 0, result = []; @@ -1655,7 +1670,6 @@ // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) - var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); @@ -2013,9 +2027,9 @@ */ function createPad(string, length, chars) { var strLength = string.length; - length |= 0; + length = +length; - if (strLength >= length) { + if (strLength >= length || !nativeIsFinite(length)) { return ''; } var padLength = length - strLength; @@ -2043,11 +2057,9 @@ * provided to the new function. * @param {Array} [partialRightArgs] An array of arguments to append to those * provided to the new function. - * @param {Array} [partialHolders] An array of `partialArgs` placeholder indexes. - * @param {Array} [partialRightHolders] An array of `partialRightArgs` placeholder indexes. * @returns {Function} Returns the new function. */ - function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders) { + function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs) { var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isPartial = bitmask & PARTIAL_FLAG, @@ -2110,17 +2122,17 @@ data[1] |= bitmask; return createWrapper.apply(null, data); } - if (arity == null) { - arity = isBindKey ? 0 : func.length; - } else if (arity < 0) { - arity = 0; - } if (isPartial) { - partialHolders = []; + var partialHolders = []; } if (isPartialRight) { - partialRightHolders = []; + var partialRightHolders = []; } + if (arity == null) { + arity = isBindKey ? 0 : func.length; + } + arity = nativeMax(arity, 0); + // fast path for `_.bind` data = [func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]; return (bitmask == BIND_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) @@ -2221,12 +2233,13 @@ result = []; if (typeof objLength == 'number' && objLength > 0) { - var allowIndexes = isArray(object) || (support.unindexedChars && isString(object)), + var keyIndex, + allowIndexes = isArray(object) || (support.nonEnumStrings && isString(object)), maxIndex = objLength - 1; } while (++index < length) { var key = props[index]; - if ((allowIndexes && key > -1 && key <= maxIndex && key % 1 == 0) || + if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) || hasOwnProperty.call(object, key)) { result.push(key); } @@ -2662,7 +2675,7 @@ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0); + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return (length && array[index] === value) ? index : -1; @@ -2822,8 +2835,7 @@ function lastIndexOf(array, value, fromIndex) { var index = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex |= 0; - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; + index = (fromIndex < 0 ? nativeMax(index + fromIndex, 0) : nativeMin(fromIndex || 0, index - 1)) + 1; } while (index--) { if (array[index] === value) { @@ -2971,7 +2983,7 @@ var index = -1, length = array ? array.length : 0; - start = +start || 0; + start = typeof start == 'undefined' ? 0 : (+start || 0); if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { @@ -3596,7 +3608,7 @@ */ function contains(collection, target, fromIndex) { var length = collection ? collection.length : 0; - fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0; + fromIndex = (typeof fromIndex == 'number' && fromIndex) || 0; if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) { if (typeof collection == 'string' || !isArray(collection) && isString(collection)) { @@ -3608,7 +3620,7 @@ : collection.indexOf(target, fromIndex) > -1; } var indexOf = getIndexOf(); - fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex; + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; return indexOf(collection, target, fromIndex) > -1; } var index = -1, @@ -4493,7 +4505,7 @@ return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); return result; } @@ -4776,6 +4788,7 @@ if (!isFunction(func)) { throw new TypeError; } + n = nativeIsFinite(n = +n) ? n : 0; return function() { if (--n < 1) { return func.apply(this, arguments); @@ -5048,7 +5061,7 @@ trailing = false; } else if (isObject(options)) { leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); + maxWait = 'maxWait' in options && nativeMax(wait, +options.maxWait || 0); trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { @@ -6512,27 +6525,28 @@ if (!isObject(object)) { return []; } - var length = object.length; + var isArr, + keyIndex, + length = object.length; + length = (typeof length == 'number' && length > 0 && - (isArray(object) || (support.unindexedChars && isString(object)) || + ((isArr = isArray(object)) || (support.nonEnumStrings && isString(object)) || (support.nonEnumArgs && isArguments(object))) && length) >>> 0; - var maxIndex = length - 1, + var index = -1, + maxIndex = length - 1, result = Array(length), - skipIndexes = length > 0, + skipIndexes = isArr && 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); - } + while (++index < length) { + result[index] = String(index); } for (var key in object) { if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name')) && - !(skipIndexes && key > -1 && key <= maxIndex && key % 1 == 0)) { + !(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0))) { result.push(key); } } @@ -6929,7 +6943,10 @@ * // => 'helloWorld' */ var camelCase = createCompounder(function(result, word, index) { - return result + word.charAt(0)[index ? 'toUpperCase' : 'toLowerCase']() + word.slice(1); + if (!index && reAllCaps.test(word)) { + return result + word.toLowerCase(); + } + return result + (word.charAt(0)[index ? 'toUpperCase' : 'toLowerCase']() + word.slice(1)); }); /** @@ -6980,7 +6997,7 @@ target = String(target); var length = string.length; - position = (typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), length) : length) - target.length; + position = (typeof position == 'undefined' ? length : nativeMin(position < 0 ? 0 : (+position || 0), length)) - target.length; return position >= 0 && string.indexOf(target, position) == position; } @@ -7077,10 +7094,10 @@ */ function pad(string, length, chars) { string = string == null ? '' : String(string); - length |= 0; + length = +length; var strLength = string.length; - if (strLength >= length) { + if (strLength >= length || !nativeIsFinite(length)) { return string; } var mid = (length - strLength) / 2, @@ -7169,9 +7186,9 @@ */ function repeat(string, n) { var result = ''; - n |= 0; + n = +n; - if (n < 1 || string == null) { + if (n < 1 || string == null || !nativeIsFinite(n)) { return result; } string = String(string); @@ -7233,7 +7250,7 @@ */ function startsWith(string, target, position) { string = string == null ? '' : String(string); - position = typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), string.length) : 0; + position = typeof position == 'undefined' ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); return string.lastIndexOf(target, position) == position; } @@ -8040,7 +8057,7 @@ // use `Array(length)` so engines like Chakra and V8 avoid slower modes // http://youtu.be/XAqIpGU8ZZk#t=17m25s var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), + length = nativeMax(ceil((end - start) / (step || 1)), 0), result = Array(length); while (++index < length) { @@ -8115,7 +8132,7 @@ * // => also calls `mage.castSpell(n)` three times */ function times(n, callback, thisArg) { - n = (n = +n) > -1 ? n : 0; + n = n < 0 ? 0 : n >>> 0; var index = -1, result = Array(n); @@ -8340,10 +8357,10 @@ lodash.first = first; lodash.last = last; lodash.sample = sample; - lodash.take = first; - lodash.takeRight = last; - lodash.takeRightWhile = last; - lodash.takeWhile = first; + lodash.take = take; + lodash.takeRight = takeRight; + lodash.takeRightWhile = takeRightWhile; + lodash.takeWhile = takeWhile; // add aliases lodash.head = first; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 7eaa54f1e..dd223fd9e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,67 +3,67 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){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 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 +;(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(nr||13r||8202e||13e||8202i(t,l)&&f.push(l);return f}function gt(n,t){var e=-1,r=n,u=n?n.length:0;if(typeof u=="number"&&-1a(s,g)&&((u||f)&&s.push(g),c.push(p))}return c}function At(n,t){for(var e=-1,r=t(n),u=r.length,o=Re(u);++ei?0:i)}function zt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?yr(u+r,0):r||0;else if(r)return r=Zt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Dt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,i=0;for(t=o.createCallback(t,e,3);u--&&t(n[u],u,n);)i++}else i=null==t||e?1:t;return i=r-i,Ut(n,0,0>i?0:i)}function Bt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,i=0;for(t=o.createCallback(t,e,3);u--&&t(n[u],u,n);)i++}else if(i=t,null==i||e)return n?n[r-1]:w; +return i=r-i,Ut(n,0>i?0:i)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=-1,u=n?n.length:0,i=0;for(t=o.createCallback(t,e,3);++rt?0:t;return Ut(n,i)}function Ut(n,t,e){var r=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=yr(u+t,0):t>u&&(t=u),e=typeof e=="undefined"?u:+e||0,0>e?e=yr(u+e,0):e>u&&(e=u),u=t>e?0:e-t,e=Re(u);++r>>1,e(n[r])e?0:e);++te?yr(r+e,0):e,-1u?0:u>>>0);if(t=o.createCallback(t,e,3),Lr(n))for(;++ri&&(i=l)}else t=null==t&&be(n)?u:o.createCallback(t,e,3),gt(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,i=n)});return i}function re(n,t,e,r){var u=3>arguments.length;if(t=o.createCallback(t,r,4),Lr(n)){var i=-1,a=n.length; +for(u&&a&&(e=n[++i]);++iarguments.length;return t=o.createCallback(t,r,4),ht(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function oe(n){var t=-1,e=n&&n.length,r=Re(0>e?0:e>>>0);return gt(n,function(n){var e=Ot(0,++t);r[t]=r[e],r[e]=n}),r}function ie(n,t,e){var r;if(t=o.createCallback(t,e,3),Lr(n)){e=-1;for(var u=n.length;++earguments.length)return Nt(n,x,null,t);if(n)var e=n[S]?n[S][2]:n.length,r=Ut(arguments,2),e=e-r.length;return Nt(n,x|O,e,t,r)}function le(n,t,e){var r,u,o,i,a,l,f,c=0,s=false,p=true;if(!ve(n))throw new Be;if(t=0>t?0:t,true===e)var g=true,p=false;else ye(e)&&(g=e.leading,s="maxWait"in e&&yr(t,+e.maxWait||0),p="trailing"in e?e.trailing:p);var h=function(){var e=t-(Ur()-i);0>=e||e>t?(u&&Je(u),e=f,u=l=f=w,e&&(c=Ur(),o=n.apply(a,r),l||u||(r=a=null))):l=ir(h,e)},v=function(){l&&Je(l),u=l=f=w,(p||s!==t)&&(c=Ur(),o=n.apply(a,r),l||u||(r=a=null)) +};return function(){if(r=arguments,i=Ur(),a=this,f=p&&(l||!g),false===s)var e=g&&!l;else{u||g||(c=i);var y=s-(i-c),m=0>=y||y>s;m?(u&&(u=Je(u)),c=i,o=n.apply(a,r)):u||(u=ir(v,y))}return m&&l?l=Je(l):l||t===s||(l=ir(h,t)),e&&(m=true,o=n.apply(a,r)),!m||l||u||(r=a=null),o}}function fe(n){if(!ve(n))throw new Be;return function(){return!n.apply(this,arguments)}}function ce(n,t,e){var r=arguments;if(!n||2>r.length)return n;var u=0,o=r.length,i=typeof e;if("number"!=i&&"string"!=i||!r[3]||r[3][e]!==t||(o=2),3arguments.length)return t;var e=Ut(arguments);return e.push(n),ce.apply(null,e)}function pe(n){var t=[];return wt(n,function(n,e){ve(n)&&t.push(e)}),t.sort()}function ge(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ye.call(n)==Q||false}function he(n){return n&&typeof n=="object"&&1===n.nodeType&&(Or.nodeClass?-1>>0,u=-1,o=r-1,i=Re(r); +t=t&&0t||null==n||!gr(t))return e;n=De(n);do t%2&&(e+=n),t=Qe(t/2),n+=n;while(t);return e}function ke(n,t,e){var r=typeof n;return"function"==r||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||Z(n,t,e):"object"!=r?Ie(n):Ee(n)}function Oe(n){return n}function Ee(n){n||(n={}); +var t=Fr(n),e=t.length,r=t[0],u=n[r];return 1!=e||u!==u||ye(u)?function(r){for(var u=e,o=false;u--&&(o=t[u],o=er.call(r,o)&&jt(r[o],n[o],null,true)););return o}:function(n){return er.call(n,r)?(n=n[r],u===n&&(0!==u||1/u==1/n)):false}}function Ae(n,t,e){var r=true,u=t&&pe(t);t&&(e||u.length)||(null==e&&(e=t),t=n,n=o,u=pe(t)),false===e?r=false:ye(e)&&"chain"in e&&(r=e.chain),e=-1;for(var i=ve(n),a=u?u.length:0;++e--n?t.apply(this,arguments):void 0}},o.assign=ce,o.at=function(n,t){var e=arguments,r=-1,u=yt(e,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!e[2]||e[2][t]!==n||(o=1),Or.unindexedChars&&be(n)&&(n=n.split("")),e=Re(o);++rarguments.length?Nt(t,x|C,null,n):Nt(t,x|C|O,null,n,Ut(arguments,2))},o.chain=function(n){return new i(n,true)},o.compact=function(n){for(var t=-1,e=n?n.length:0,r=0,u=[];++t(p?r(p,l):i(s,l))){for(t=u;--t;){var g=o[t];if(0>(g?r(g,l):i(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},o.invert=function(n,t){for(var e=-1,r=Fr(n),u=r.length,o={};++eo?0:o>>>0);return gt(n,function(n){var o=u?t:null!=n&&n[t];i[++r]=o?o.apply(n,e):w}),i},o.keys=Fr,o.keysIn=_e,o.map=te,o.mapValues=function(n,t,e){var r={};return t=o.createCallback(t,e,3),xt(n,function(n,e,u){r[e]=t(n,e,u)}),r},o.matches=Ee,o.max=ee,o.memoize=function(n,t){if(!ve(n))throw new Be;var e=function(){var r=e.cache,u=t?t.apply(this,arguments):"_"+arguments[0]; +return er.call(r,u)?r[u]:r[u]=n.apply(this,arguments)};return e.cache={},e},o.merge=function(n,t,e){if(!n)return n;var r=arguments,u=r.length,o=typeof e;if("number"!=o&&"string"!=o||!r[3]||r[3][e]!==t||(u=2),3u?0:u>>>0);for(i||(t=o.createCallback(t,e,3)),gt(n,function(n,e,u){if(i)for(e=t.length,u=Re(e);e--;)u[e]=n[t[e]]; +else u=t(n,e,u);f[++r]={a:u,b:r,c:n}}),u=f.length,f.sort(i?l:a);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,e){return t.call(e,n),n},o.throttle=function(n,t,e){var r=true,u=true;if(!ve(n))throw new Be;return false===e?r=false:ye(e)&&(r="leading"in e?!!e.leading:r,u="trailing"in e?!!e.trailing:u),ct.leading=r,ct.maxWait=+t,ct.trailing=u,le(n,t,ct)},o.times=function(n,t,e){n=0>n?0:n>>>0;var r=-1,u=Re(n);for(t=Z(t,e,1);++re?0:+e||0,r))-t.length,0<=e&&n.indexOf(t,e)==e},o.escape=function(n){return null==n?"":De(n).replace(F,s)},o.escapeRegExp=Ce,o.every=Gt,o.find=Jt,o.findIndex=$t,o.findKey=function(n,t,e){return t=o.createCallback(t,e,3),vt(n,t,xt,true)},o.findLast=function(n,t,e){return t=o.createCallback(t,e,3),vt(n,t,ht) +},o.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=o.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},o.findLastKey=function(n,t,e){return t=o.createCallback(t,e,3),vt(n,t,Ct,true)},o.has=function(n,t){return n?er.call(n,t):false},o.identity=Oe,o.indexOf=zt,o.isArguments=ge,o.isArray=Lr,o.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ye.call(n)==tt||false},o.isDate=function(n){return n&&typeof n=="object"&&Ye.call(n)==et||false},o.isElement=he,o.isEmpty=function(n){var t=true; +if(!n)return t;var e=Ye.call(n),r=n.length;return-1e?yr(r+e,0):mr(e||0,r-1))+1);r--;)if(n[r]===t)return r;return-1},o.mixin=Ae,o.noConflict=function(){return t._=Ve,this},o.noop=Se,o.now=Ur,o.pad=function(n,t,e){n=null==n?"":De(n),t=+t;var r=n.length;return re?0:+e||0,n.length),n.lastIndexOf(t,e)==e},o.template=function(n,t,e){var r=o.templateSettings;e=se({},e,r),n=De(null==n?"":n);var u,i,a=se({},e.imports,r.imports),r=Fr(a),a=xe(a),l=0,f=e.interpolate||K,c="__p+='",f=ze((e.escape||K).source+"|"+f.source+"|"+(f===z?D:K).source+"|"+(e.evaluate||K).source+"|$","g"); +n.replace(f,function(t,e,r,o,a,f){return r||(r=o),c+=n.slice(l,f).replace(X,p),e&&(u=true,c+="'+__e("+e+")+'"),a&&(i=true,c+="';"+a+";\n__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),l=f+t.length,t}),c+="';",(e=e.variable)||(c="with(obj){"+c+"}"),c=(i?c.replace(N,""):c).replace(T,"$1").replace(L,"$1;"),c="function("+(e||"obj")+"){"+(e?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var s=We(r,"return "+c).apply(w,a) +}catch(g){throw g.source=c,g}return t?s(t):(s.source=c,s)},o.trim=Dr,o.trimLeft=Br,o.trimRight=qr,o.truncate=function(n,t){var e=30,r="...";if(t&&ye(t))var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e,r="omission"in t?De(t.omission):r;else null!=t&&(e=+t||0);if(n=null==n?"":De(n),e>=n.length)return n;var o=e-r.length;if(1>o)return r;if(e=n.slice(0,o),null==u)return e+r;if(de(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=ze(u.source,(B.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index; +e=e.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=e.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(W,b))},o.uniqueId=function(n){var t=++I;return De(null==n?"":n)+t},o.all=Gt,o.any=ie,o.detect=Jt,o.findWhere=Jt,o.foldl=re,o.foldr=ue,o.include=Yt,o.inject=re,Ae(function(){var n={};return xt(o,function(t,e){o.prototype[e]||(n[e]=t)}),n}(),false),o.first=Pt,o.last=Bt,o.sample=function(n,t,e){return n&&typeof n.length!="number"?n=xe(n):Or.unindexedChars&&be(n)&&(n=n.split("")),null==t||e?(t=n?n.length:0,0t?0:+t||0,n.length),n) +},o.take=Pt,o.takeRight=Bt,o.takeRightWhile=Bt,o.takeWhile=Pt,o.head=Pt,xt(o,function(n,t){var e="sample"!==t;o.prototype[t]||(o.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new i(o,u):o})}),o.VERSION=A,o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.toString=function(){return De(this.__wrapped__)},o.prototype.value=Xt,o.prototype.valueOf=Xt,gt(["join","pop","shift"],function(n){var t=qe[n];o.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); +return n?new i(e,n):e}}),gt(["push","reverse","sort","unshift"],function(n){var t=qe[n];o.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),gt(["concat","splice"],function(n){var t=qe[n];o.prototype[n]=function(){return new i(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Or.spliceObjects||gt(["pop","shift","splice"],function(n){var t=qe[n],e="splice"==n;o.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new i(u,n):u +}}),o}var w,x=1,C=2,j=4,k=8,O=16,E=32,A="2.4.1",S="__lodash@"+A+"__",I=0,R=/^[A-Z]+$/,N=/\b__p\+='';/g,T=/\b(__p\+=)''\+/g,L=/(__e\(.*?\)|\b__t\))\+'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,$=/<%-([\s\S]+?)%>/g,P=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,q=/^\s*function[ \n\r\t]+\w/,U=/^0[xX]/,Z=/[\xC0-\xFF]/g,K=/($^)/,M=/[.*+?^${}()|[\]\\]/g,V=/\bthis\b/,X=/['\n\r\u2028\u2029\\]/g,Y=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,G=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",H="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),J="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Q="[object Arguments]",nt="[object Array]",tt="[object Boolean]",et="[object Date]",rt="[object Error]",ut="[object Function]",ot="[object Number]",it="[object Object]",at="[object RegExp]",lt="[object String]",ft={}; +ft[ut]=false,ft[Q]=ft[nt]=ft[tt]=ft[et]=ft[ot]=ft[it]=ft[at]=ft[lt]=true;var ct={leading:false,maxWait:0,trailing:false},st={configurable:false,enumerable:false,value:null,writable:false},pt={"&":"&","<":"<",">":">",'"':""","'":"'"},gt={"&":"&","<":"<",">":">",""":'"',"'":"'"},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":" "},vt={"function":true,object:true},yt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},mt=vt[typeof window]&&window||this,dt=vt[typeof exports]&&exports&&!exports.nodeType&&exports,vt=vt[typeof module]&&module&&!module.nodeType&&module,bt=dt&&vt&&typeof global=="object"&&global; +!bt||bt.global!==bt&&bt.window!==bt&&bt.self!==bt||(mt=bt);var bt=vt&&vt.exports===dt&&dt,_t=_();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(mt._=_t, define(function(){return _t})):dt&&vt?bt?(vt.exports=_t)._=_t:dt._=_t:mt._=_t}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 43ac76c61..f6a2ef7d1 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -29,6 +29,9 @@ /** Used to generate unique IDs */ var idCounter = 0; + /** Used to detect words composed of all capital letters */ + var reAllCaps = /^[A-Z]+$/; + /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -76,10 +79,10 @@ var reThis = /\bthis\b/; /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to match words to create compound words */ - var reWords = /[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g; + var reWords = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g; /** Used to detect and test whitespace */ var whitespace = ( @@ -200,7 +203,6 @@ "'": "'", '\n': 'n', '\r': 'r', - '\t': 't', '\u2028': 'u2028', '\u2029': 'u2029' }; @@ -268,7 +270,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - var index = (+fromIndex || 0) - 1, + var index = (fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { @@ -947,7 +949,6 @@ var isArr = isArray(value); if (isDeep) { // check for circular references and return corresponding clone - var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); @@ -1109,14 +1110,19 @@ if (partialRightArgs) { args = composeArgsRight(partialRightArgs, partialRightHolders, args); } - if (isCurry && length < arity) { - bitmask |= PARTIAL_FLAG; - bitmask &= ~PARTIAL_RIGHT_FLAG - if (!isCurryBound) { - bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + if (isCurry) { + var newPartialHolders = []; + length -= newPartialHolders.length; + + if (length < arity) { + bitmask |= PARTIAL_FLAG; + bitmask &= ~PARTIAL_RIGHT_FLAG + if (!isCurryBound) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + var newArity = nativeMax(arity - length, 0); + return baseCreateWrapper([func, bitmask, newArity, thisArg, args, null, newPartialHolders]); } - var newArity = nativeMax(0, arity - length); - return baseCreateWrapper([func, bitmask, newArity, thisArg, args, null, []]); } var thisBinding = isBind ? thisArg : this; if (isBindKey) { @@ -1267,7 +1273,7 @@ * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (+fromIndex || 0) - 1, + var index = (fromIndex || 0) - 1, length = array ? array.length : 0, result = []; @@ -1488,7 +1494,6 @@ // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) - var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); @@ -1846,9 +1851,9 @@ */ function createPad(string, length, chars) { var strLength = string.length; - length |= 0; + length = +length; - if (strLength >= length) { + if (strLength >= length || !nativeIsFinite(length)) { return ''; } var padLength = length - strLength; @@ -1876,11 +1881,9 @@ * provided to the new function. * @param {Array} [partialRightArgs] An array of arguments to append to those * provided to the new function. - * @param {Array} [partialHolders] An array of `partialArgs` placeholder indexes. - * @param {Array} [partialRightHolders] An array of `partialRightArgs` placeholder indexes. * @returns {Function} Returns the new function. */ - function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders) { + function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs) { var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isPartial = bitmask & PARTIAL_FLAG, @@ -1943,17 +1946,17 @@ data[1] |= bitmask; return createWrapper.apply(null, data); } - if (arity == null) { - arity = isBindKey ? 0 : func.length; - } else if (arity < 0) { - arity = 0; - } if (isPartial) { - partialHolders = []; + var partialHolders = []; } if (isPartialRight) { - partialRightHolders = []; + var partialRightHolders = []; } + if (arity == null) { + arity = isBindKey ? 0 : func.length; + } + arity = nativeMax(arity, 0); + // fast path for `_.bind` data = [func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]; return (bitmask == BIND_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) @@ -2042,12 +2045,13 @@ result = []; if (typeof objLength == 'number' && objLength > 0) { - var allowIndexes = isArray(object), + var keyIndex, + allowIndexes = isArray(object), maxIndex = objLength - 1; } while (++index < length) { var key = props[index]; - if ((allowIndexes && key > -1 && key <= maxIndex && key % 1 == 0) || + if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) || hasOwnProperty.call(object, key)) { result.push(key); } @@ -2483,7 +2487,7 @@ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0); + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return (length && array[index] === value) ? index : -1; @@ -2643,8 +2647,7 @@ function lastIndexOf(array, value, fromIndex) { var index = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex |= 0; - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; + index = (fromIndex < 0 ? nativeMax(index + fromIndex, 0) : nativeMin(fromIndex || 0, index - 1)) + 1; } while (index--) { if (array[index] === value) { @@ -2792,7 +2795,7 @@ var index = -1, length = array ? array.length : 0; - start = +start || 0; + start = typeof start == 'undefined' ? 0 : (+start || 0); if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { @@ -3414,7 +3417,7 @@ */ function contains(collection, target, fromIndex) { var length = collection ? collection.length : 0; - fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0; + fromIndex = (typeof fromIndex == 'number' && fromIndex) || 0; if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) { if (typeof collection == 'string' || !isArray(collection) && isString(collection)) { @@ -3426,7 +3429,7 @@ : collection.indexOf(target, fromIndex) > -1; } var indexOf = getIndexOf(); - fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex; + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; return indexOf(collection, target, fromIndex) > -1; } var index = -1, @@ -4315,7 +4318,7 @@ return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); return result; } @@ -4596,6 +4599,7 @@ if (!isFunction(func)) { throw new TypeError; } + n = nativeIsFinite(n = +n) ? n : 0; return function() { if (--n < 1) { return func.apply(this, arguments); @@ -4868,7 +4872,7 @@ trailing = false; } else if (isObject(options)) { leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); + maxWait = 'maxWait' in options && nativeMax(wait, +options.maxWait || 0); trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { @@ -6316,16 +6320,14 @@ if (!isObject(object)) { return []; } - var length = isArray(object) ? object.length : 0, + var index = -1, + 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); - } + while (++index < length) { + result[index] = String(index); } for (var key in object) { if (!(skipIndexes && key > -1 && key <= maxIndex && key % 1 == 0)) { @@ -6705,7 +6707,10 @@ * // => 'helloWorld' */ var camelCase = createCompounder(function(result, word, index) { - return result + word.charAt(0)[index ? 'toUpperCase' : 'toLowerCase']() + word.slice(1); + if (!index && reAllCaps.test(word)) { + return result + word.toLowerCase(); + } + return result + (word.charAt(0)[index ? 'toUpperCase' : 'toLowerCase']() + word.slice(1)); }); /** @@ -6756,7 +6761,7 @@ target = String(target); var length = string.length; - position = (typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), length) : length) - target.length; + position = (typeof position == 'undefined' ? length : nativeMin(position < 0 ? 0 : (+position || 0), length)) - target.length; return position >= 0 && string.indexOf(target, position) == position; } @@ -6853,10 +6858,10 @@ */ function pad(string, length, chars) { string = string == null ? '' : String(string); - length |= 0; + length = +length; var strLength = string.length; - if (strLength >= length) { + if (strLength >= length || !nativeIsFinite(length)) { return string; } var mid = (length - strLength) / 2, @@ -6945,9 +6950,9 @@ */ function repeat(string, n) { var result = ''; - n |= 0; + n = +n; - if (n < 1 || string == null) { + if (n < 1 || string == null || !nativeIsFinite(n)) { return result; } string = String(string); @@ -7009,7 +7014,7 @@ */ function startsWith(string, target, position) { string = string == null ? '' : String(string); - position = typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), string.length) : 0; + position = typeof position == 'undefined' ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); return string.lastIndexOf(target, position) == position; } @@ -7816,7 +7821,7 @@ // use `Array(length)` so engines like Chakra and V8 avoid slower modes // http://youtu.be/XAqIpGU8ZZk#t=17m25s var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), + length = nativeMax(ceil((end - start) / (step || 1)), 0), result = Array(length); while (++index < length) { @@ -7891,7 +7896,7 @@ * // => also calls `mage.castSpell(n)` three times */ function times(n, callback, thisArg) { - n = (n = +n) > -1 ? n : 0; + n = n < 0 ? 0 : n >>> 0; var index = -1, result = Array(n); @@ -8116,10 +8121,10 @@ lodash.first = first; lodash.last = last; lodash.sample = sample; - lodash.take = first; - lodash.takeRight = last; - lodash.takeRightWhile = last; - lodash.takeWhile = first; + lodash.take = take; + lodash.takeRight = takeRight; + lodash.takeRightWhile = takeRightWhile; + lodash.takeWhile = takeWhile; // add aliases lodash.head = first; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index cca3014d3..1492c0751 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,63 +3,63 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202i(t,l)&&f.push(l);return f}function ft(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number"&&-1a(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){var t=-1,r=vr(n),e=r.length,u=e&&n.length,o=[];if(typeof u=="number"&&0i?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 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 +;(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(nr||13r||8202e||13e||8202i(t,l)&&f.push(l);return f}function ct(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number"&&-1a(p,h)&&((u||f)&&p.push(h),c.push(s))}return c}function Ct(n,t){for(var e=-1,r=t(n),u=r.length,o=Ie(u);++ei?0:i)}function $t(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?cr(u+r,0):r||0;else if(r)return r=qt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Lt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,i=0;for(t=o.createCallback(t,e,3);u--&&t(n[u],u,n);)i++}else i=null==t||e?1:t;return i=r-i,Bt(n,0,0>i?0:i)}function zt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,i=0; +for(t=o.createCallback(t,e,3);u--&&t(n[u],u,n);)i++}else if(i=t,null==i||e)return n?n[r-1]:_;return i=r-i,Bt(n,0>i?0:i)}function Dt(n,t,e){if(typeof t!="number"&&null!=t){var r=-1,u=n?n.length:0,i=0;for(t=o.createCallback(t,e,3);++rt?0:t;return Bt(n,i)}function Bt(n,t,e){var r=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=cr(u+t,0):t>u&&(t=u),e=typeof e=="undefined"?u:+e||0,0>e?e=cr(u+e,0):e>u&&(e=u),u=t>e?0:e-t,e=Ie(u);++r>>1,e(n[r])e?0:e);++te?cr(r+e,0):e,-1i&&(i=l)}else t=null==t&&ye(n)?u:o.createCallback(t,e,3),ct(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,i=n)});return i}function ne(n,t,e,r){var u=3>arguments.length;t=o.createCallback(t,r,4);var i=-1,a=n?n.length:0;if(typeof a=="number"&&-1arguments.length; +return t=o.createCallback(t,r,4),pt(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function ee(n){var t=-1,e=n&&n.length,r=Ie(0>e?0:e>>>0);return ct(n,function(n){var e=kt(0,++t);r[t]=r[e],r[e]=n}),r}function re(n,t,e){var r;t=o.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return Et(n,w,null,t);if(n)var e=n[I]?n[I][2]:n.length,r=Bt(arguments,2),e=e-r.length; +return Et(n,w|C,e,t,r)}function oe(n,t,e){var r,u,o,i,a,l,f,c=0,p=false,s=true;if(!se(n))throw new Le;if(t=0>t?0:t,true===e)var h=true,s=false;else he(e)&&(h=e.leading,p="maxWait"in e&&cr(t,+e.maxWait||0),s="trailing"in e?e.trailing:s);var g=function(){var e=t-(Lr()-i);0>=e||e>t?(u&&Ve(u),e=f,u=l=f=_,e&&(c=Lr(),o=n.apply(a,r),l||u||(r=a=null))):l=nr(g,e)},v=function(){l&&Ve(l),u=l=f=_,(s||p!==t)&&(c=Lr(),o=n.apply(a,r),l||u||(r=a=null))};return function(){if(r=arguments,i=Lr(),a=this,f=s&&(l||!h),false===p)var e=h&&!l; +else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=Ve(u)),c=i,o=n.apply(a,r)):u||(u=nr(v,y))}return m&&l?l=Ve(l):l||t===p||(l=nr(g,t)),e&&(m=true,o=n.apply(a,r)),!m||l||u||(r=a=null),o}}function ie(n){if(!se(n))throw new Le;return function(){return!n.apply(this,arguments)}}function ae(n,t,e){var r=arguments;if(!n||2>r.length)return n;var u=0,o=r.length,i=typeof e;if("number"!=i&&"string"!=i||!r[3]||r[3][e]!==t||(o=2),3arguments.length)return t;var e=Bt(arguments);return e.push(n),ae.apply(null,e)}function fe(n){var t=[];return dt(n,function(n,e){se(n)&&t.push(e)}),t.sort()}function ce(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Pe.call(n)==H||false}function pe(n){return n&&typeof n=="object"&&1===n.nodeType&&-1t||null==n||!ar(t))return e;n=$e(n);do t%2&&(e+=n),t=Xe(t/2),n+=n;while(t);return e}function xe(n,t,e){var r=typeof n;return"function"==r||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||Z(n,t,e):"object"!=r?Ae(n):je(n)}function ke(n){return n}function je(n){n||(n={}); +var t=Rr(n),e=t.length,r=t[0],u=n[r];return 1!=e||u!==u||he(u)?function(r){for(var u=e,o=false;u--&&(o=t[u],o=He.call(r,o)&&wt(r[o],n[o],null,true)););return o}:function(n){return He.call(n,r)?(n=n[r],u===n&&(0!==u||1/u==1/n)):false}}function Ce(n,t,e){var r=true,u=t&&fe(t);t&&(e||u.length)||(null==e&&(e=t),t=n,n=o,u=fe(t)),false===e?r=false:he(e)&&"chain"in e&&(r=e.chain),e=-1;for(var i=se(n),a=u?u.length:0;++e--n?t.apply(this,arguments):void 0 +}},o.assign=ae,o.at=function(n,t){var e=arguments,r=-1,u=ht(e,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!e[2]||e[2][t]!==n||(o=1),e=Ie(o);++rarguments.length?Et(t,w|x,null,n):Et(t,w|x|C,null,n,Bt(arguments,2))},o.chain=function(n){return new i(n,true)},o.compact=function(n){for(var t=-1,e=n?n.length:0,r=0,u=[];++t(s?r(s,l):i(p,l))){for(t=u;--t;){var h=o[t]; +if(0>(h?r(h,l):i(n[t],l)))continue n}s&&s.push(l),p.push(l)}return p},o.invert=function(n,t){for(var e=-1,r=Rr(n),u=r.length,o={};++eo?0:o>>>0);return ct(n,function(n){var o=u?t:null!=n&&n[t];i[++r]=o?o.apply(n,e):_}),i},o.keys=Rr,o.keysIn=me,o.map=Jt,o.mapValues=function(n,t,e){var r={};return t=o.createCallback(t,e,3),bt(n,function(n,e,u){r[e]=t(n,e,u) +}),r},o.matches=je,o.max=Qt,o.memoize=function(n,t){if(!se(n))throw new Le;var e=function(){var r=e.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return He.call(r,u)?r[u]:r[u]=n.apply(this,arguments)};return e.cache={},e},o.merge=function(n,t,e){if(!n)return n;var r=arguments,u=r.length,o=typeof e;if("number"!=o&&"string"!=o||!r[3]||r[3][e]!==t||(u=2),3u?0:u>>>0);for(i||(t=o.createCallback(t,e,3)),ct(n,function(n,e,u){if(i)for(e=t.length,u=Ie(e);e--;)u[e]=n[t[e]]; +else u=t(n,e,u);f[++r]={a:u,b:r,c:n}}),u=f.length,f.sort(i?l:a);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,e){return t.call(e,n),n},o.throttle=function(n,t,e){var r=true,u=true;if(!se(n))throw new Le;return false===e?r=false:he(e)&&(r="leading"in e?!!e.leading:r,u="trailing"in e?!!e.trailing:u),at.leading=r,at.maxWait=+t,at.trailing=u,oe(n,t,at)},o.times=function(n,t,e){n=0>n?0:n>>>0;var r=-1,u=Ie(n);for(t=Z(t,e,1);++re?0:+e||0,r))-t.length,0<=e&&n.indexOf(t,e)==e},o.escape=function(n){return null==n?"":$e(n).replace(F,p)},o.escapeRegExp=_e,o.every=Vt,o.find=Yt,o.findIndex=Wt,o.findKey=function(n,t,e){return t=o.createCallback(t,e,3),st(n,t,bt,true)},o.findLast=function(n,t,e){return t=o.createCallback(t,e,3),st(n,t,pt) +},o.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=o.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},o.findLastKey=function(n,t,e){return t=o.createCallback(t,e,3),st(n,t,_t,true)},o.has=function(n,t){return n?He.call(n,t):false},o.identity=ke,o.indexOf=$t,o.isArguments=ce,o.isArray=Ir,o.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Pe.call(n)==Q||false},o.isDate=function(n){return n&&typeof n=="object"&&Pe.call(n)==nt||false},o.isElement=pe,o.isEmpty=function(n){var t=true; +if(!n)return t;var e=Pe.call(n),r=n.length;return-1e?cr(r+e,0):pr(e||0,r-1))+1);r--;)if(n[r]===t)return r;return-1},o.mixin=Ce,o.noConflict=function(){return t._=Ue,this},o.noop=Oe,o.now=Lr,o.pad=function(n,t,e){n=null==n?"":$e(n),t=+t;var r=n.length;return re?0:+e||0,n.length),n.lastIndexOf(t,e)==e},o.template=function(n,t,e){var r=o.templateSettings;e=le({},e,r),n=$e(null==n?"":n);var u,i,a=le({},e.imports,r.imports),r=Rr(a),a=be(a),l=0,f=e.interpolate||P,c="__p+='",f=Fe((e.escape||P).source+"|"+f.source+"|"+(f===z?D:P).source+"|"+(e.evaluate||P).source+"|$","g"); +n.replace(f,function(t,e,r,o,a,f){return r||(r=o),c+=n.slice(l,f).replace(V,s),e&&(u=true,c+="'+__e("+e+")+'"),a&&(i=true,c+="';"+a+";\n__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),l=f+t.length,t}),c+="';",(e=e.variable)||(c="with(obj){"+c+"}"),c=(i?c.replace(N,""):c).replace(S,"$1").replace(T,"$1;"),c="function("+(e||"obj")+"){"+(e?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var p=Ne(r,"return "+c).apply(_,a) +}catch(h){throw h.source=c,h}return t?p(t):(p.source=c,p)},o.trim=Wr,o.trimLeft=Fr,o.trimRight=$r,o.truncate=function(n,t){var e=30,r="...";if(t&&he(t))var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e,r="omission"in t?$e(t.omission):r;else null!=t&&(e=+t||0);if(n=null==n?"":$e(n),e>=n.length)return n;var o=e-r.length;if(1>o)return r;if(e=n.slice(0,o),null==u)return e+r;if(ve(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Fe(u.source,(B.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index; +e=e.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=e.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(W,d))},o.uniqueId=function(n){var t=++E;return $e(null==n?"":n)+t},o.all=Vt,o.any=re,o.detect=Yt,o.findWhere=Yt,o.foldl=ne,o.foldr=te,o.include=Mt,o.inject=ne,Ce(function(){var n={};return bt(o,function(t,e){o.prototype[e]||(n[e]=t)}),n}(),false),o.first=Ft,o.last=zt,o.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=be(n)),null==t||e?(t=n?n.length:0,0t?0:+t||0,n.length),n) +},o.take=Ft,o.takeRight=zt,o.takeRightWhile=zt,o.takeWhile=Ft,o.head=Ft,bt(o,function(n,t){var e="sample"!==t;o.prototype[t]||(o.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new i(o,u):o})}),o.VERSION=A,o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.toString=function(){return $e(this.__wrapped__)},o.prototype.value=Kt,o.prototype.valueOf=Kt,ct(["join","pop","shift"],function(n){var t=ze[n];o.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); +return n?new i(e,n):e}}),ct(["push","reverse","sort","unshift"],function(n){var t=ze[n];o.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ct(["concat","splice"],function(n){var t=ze[n];o.prototype[n]=function(){return new i(t.apply(this.__wrapped__,arguments),this.__chain__)}}),o}var _,w=1,x=2,k=4,j=8,C=16,O=32,A="2.4.1",I="__lodash@"+A+"__",E=0,R=/^[A-Z]+$/,N=/\b__p\+='';/g,S=/\b(__p\+=)''\+/g,T=/(__e\(.*?\)|\b__t\))\+'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,$=/<%-([\s\S]+?)%>/g,L=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,q=/^\s*function[ \n\r\t]+\w/,U=/^0[xX]/,Z=/[\xC0-\xFF]/g,P=/($^)/,K=/[.*+?^${}()|[\]\\]/g,M=/\bthis\b/,V=/['\n\r\u2028\u2029\\]/g,X=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-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 Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),H="[object Arguments]",J="[object Array]",Q="[object Boolean]",nt="[object Date]",tt="[object Function]",et="[object Number]",rt="[object Object]",ut="[object RegExp]",ot="[object String]",it={}; +it[tt]=false,it[H]=it[J]=it[Q]=it[nt]=it[et]=it[rt]=it[ut]=it[ot]=true;var at={leading:false,maxWait:0,trailing:false},lt={configurable:false,enumerable:false,value:null,writable:false},ft={"&":"&","<":"<",">":">",'"':""","'":"'"},ct={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},st={"function":true,object:true},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},gt=st[typeof window]&&window||this,vt=st[typeof exports]&&exports&&!exports.nodeType&&exports,st=st[typeof module]&&module&&!module.nodeType&&module,yt=vt&&st&&typeof global=="object"&&global; +!yt||yt.global!==yt&&yt.window!==yt&&yt.self!==yt||(gt=yt);var yt=st&&st.exports===vt&&vt,mt=b();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gt._=mt, define(function(){return mt})):vt&&st?yt?(st.exports=mt)._=mt:vt._=mt:gt._=mt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index e6f0d2545..89743b814 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -52,7 +52,7 @@ var reRegExpChars = /[.*+?^${}()|[\]\\]/g; /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', @@ -103,7 +103,6 @@ "'": "'", '\n': 'n', '\r': 'r', - '\t': 't', '\u2028': 'u2028', '\u2029': 'u2029' }; @@ -159,7 +158,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - var index = (+fromIndex || 0) - 1, + var index = (fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { @@ -501,8 +500,7 @@ thisArg = data[3], partialArgs = data[4], partialRightArgs = data[5], - partialHolders = data[6], - partialRightHolders = data[7]; + partialHolders = data[6]; var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, @@ -647,7 +645,7 @@ * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (+fromIndex || 0) - 1, + var index = (fromIndex || 0) - 1, length = array ? array.length : 0, result = []; @@ -1044,11 +1042,9 @@ * provided to the new function. * @param {Array} [partialRightArgs] An array of arguments to append to those * provided to the new function. - * @param {Array} [partialHolders] An array of `partialArgs` placeholder indexes. - * @param {Array} [partialRightHolders] An array of `partialRightArgs` placeholder indexes. * @returns {Function} Returns the new function. */ - function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders) { + function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialRightArgs) { var isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isPartial = bitmask & PARTIAL_FLAG, @@ -1062,10 +1058,15 @@ isPartial = partialArgs = false; } if (isPartial) { - partialHolders = getHolders(partialArgs); + var partialHolders = getHolders(partialArgs); } + if (arity == null) { + arity = isBindKey ? 0 : func.length; + } + arity = nativeMax(arity, 0); + // fast path for `_.bind` - var data = [func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders, partialRightHolders]; + var data = [func, bitmask, arity, thisArg, partialArgs, partialRightArgs, partialHolders]; return baseCreateWrapper(data); } @@ -1376,7 +1377,7 @@ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0); + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return (length && array[index] === value) ? index : -1; @@ -1503,8 +1504,7 @@ function lastIndexOf(array, value, fromIndex) { var index = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex |= 0; - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; + index = (fromIndex < 0 ? nativeMax(index + fromIndex, 0) : nativeMin(fromIndex || 0, index - 1)) + 1; } while (index--) { if (array[index] === value) { @@ -1558,7 +1558,7 @@ var index = -1, length = array ? array.length : 0; - start = +start || 0; + start = typeof start == 'undefined' ? 0 : (+start || 0); if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { @@ -2804,7 +2804,7 @@ return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); return result; } @@ -3078,6 +3078,7 @@ if (!isFunction(func)) { throw new TypeError; } + n = nativeIsFinite(n = +n) ? n : 0; return function() { if (--n < 1) { return func.apply(this, arguments); @@ -3265,7 +3266,7 @@ trailing = false; } else if (isObject(options)) { leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); + maxWait = 'maxWait' in options && nativeMax(wait, +options.maxWait || 0); trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { @@ -4999,7 +5000,7 @@ // use `Array(length)` so engines like Chakra and V8 avoid slower modes // http://youtu.be/XAqIpGU8ZZk#t=17m25s var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), + length = nativeMax(ceil((end - start) / (step || 1)), 0), result = Array(length); while (++index < length) { @@ -5073,7 +5074,7 @@ * // => also calls `mage.castSpell(n)` three times */ function times(n, callback, thisArg) { - n = (n = +n) > -1 ? n : 0; + n = n < 0 ? 0 : n >>> 0; var index = -1, result = Array(n); @@ -5231,7 +5232,7 @@ lodash.first = first; lodash.last = last; lodash.sample = sample; - lodash.take = first; + lodash.take = take; // add aliases lodash.head = first; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index f765d2c02..4849e9d79 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,38 +3,38 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash underscore -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r,t){t=(+t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(tu(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 b(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?_(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=/($^)/,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);++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,0e||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"&&-1o(f,c)&&(t&&f.push(c),i.push(a))}return i}function _(n,r){return function(t,e,u){var o=r?[[],[]]:{};e=tr(e,u,3),u=-1;var i=t?t.length:0;if(typeof i=="number"&&-1r?0:r)}function E(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?Zr(u+e,0):e||0;else if(e)return e=S(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function O(n,r,t){return k(n,null==r||t?1:0>r?0:r)}function k(n,r,t){var e=-1,u=n?n.length:0; +for(r=typeof r=="undefined"?0:+r||0,0>r?r=Zr(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=Zr(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=tr(r,t,3),p(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function D(n,r,t,e){var u=3>arguments.length;r=tr(r,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length; +return r=tr(r,e,4),s(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function z(n){var r=-1,t=n&&n.length,e=Array(0>t?0:t>>>0);return p(n,function(n){var t=b(++r);e[r]=e[t],e[t]=n}),e}function C(n,r,t){var e;r=tr(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length?w(n,ar,r):w(n,ar|lr,r,k(arguments,2))}function U(n,r,t){function e(){l&&clearTimeout(l),i=l=p=fr,(h||g!==r)&&(s=ht(),f=n.apply(c,o),l||i||(o=c=null)) +}function u(){var t=r-(ht()-a);0>=t||t>r?(i&&clearTimeout(i),t=p,i=l=p=fr,t&&(s=ht(),f=n.apply(c,o),l||i||(o=c=null))):l=setTimeout(u,t)}var o,i,f,a,c,l,p,s=0,g=false,h=true;if(!L(n))throw new TypeError;if(r=0>r?0:r,true===t)var v=true,h=false;else Q(t)&&(v=t.leading,g="maxWait"in t&&Zr(r,+t.maxWait||0),h="trailing"in t?t.trailing:h);return function(){if(o=arguments,a=ht(),c=this,p=h&&(l||!v),false===g)var t=v&&!l;else{i||v||(s=a);var y=g-(a-s),m=0>=y||y>g;m?(i&&(i=clearTimeout(i)),s=a,f=n.apply(c,o)):i||(i=setTimeout(e,y)) +}return m&&l?l=clearTimeout(l):l||r===g||(l=setTimeout(u,r)),t&&(m=true,f=n.apply(c,o)),!m||l||i||(o=c=null),f}}function V(n){if(!L(n))throw new TypeError;return function(){return!n.apply(this,arguments)}}function G(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,vr=/($^)/,yr=/[.*+?^${}()|[\]\\]/g,mr=/['\n\r\u2028\u2029\\]/g,br="[object Arguments]",dr="[object Array]",_r="[object Boolean]",wr="[object Date]",jr="[object Number]",xr="[object Object]",Ar="[object RegExp]",Tr="[object String]",Er={"&":"&","<":"<",">":">",'"':""","'":"'"},Or={"&":"&","<":"<",">":">",""":'"',"'":"'"},kr={"function":true,object:true},Sr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Nr=kr[typeof window]&&window||this,qr=kr[typeof exports]&&exports&&!exports.nodeType&&exports,Fr=kr[typeof module]&&module&&!module.nodeType&&module,Br=qr&&Fr&&typeof global=="object"&&global; +!Br||Br.global!==Br&&Br.window!==Br&&Br.self!==Br||(Nr=Br);var Mr=Fr&&Fr.exports===qr&&qr,Rr=Array.prototype,$r=Object.prototype,Ir=Nr._,Dr=Math.pow(2,53)-1,Wr=$r.toString,zr=RegExp("^"+(null==Wr?"":(Wr+"").replace(yr,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Cr=Math.ceil,Pr=Math.floor,Ur=Function.prototype.toString,Vr=$r.hasOwnProperty,Gr=Rr.push,Hr=$r.propertyIsEnumerable,Jr=Rr.splice,Kr=x(Kr=Object.create)&&Kr,Lr=x(Lr=Array.isArray)&&Lr,Qr=Nr.isFinite,Xr=Nr.isNaN,Yr=x(Yr=Object.keys)&&Yr,Zr=Math.max,nt=Math.min,rt=x(rt=Date.now)&&rt,tt=Math.random; +i.prototype=o.prototype;var et={};!function(){var n={0:1,length:1};et.spliceObjects=(Jr.call(n,0,1),!n[0])}(1),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Kr||(f=function(){function n(){}return function(r){if(Q(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Nr.Object()}}());var ut=O,ot=T,it=_(function(n,r,t){Vr.call(n,t)?n[t]++:n[t]=1}),ft=_(function(n,r,t){Vr.call(n,t)?n[t].push(r):n[t]=[r]}),at=_(function(n,r,t){n[t]=r +}),ct=_(function(n,r,t){n[t?0:1].push(r)},true),lt=$,pt=B;K(arguments)||(K=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Vr.call(n,"callee")&&!Hr.call(n,"callee")||false});var st=Lr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Wr.call(n)==dr||false};L(/x/)&&(L=function(n){return typeof n=="function"&&"[object Function]"==Wr.call(n)});var gt=Yr?function(n){return Q(n)?Yr(n):[]}:A,ht=rt||function(){return(new Date).getTime()};o.after=function(n,r){if(!L(r))throw new TypeError; +return n=Qr(n=+n)?n:0,function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=P,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=gt(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):fr}),i},o.keys=gt,o.map=$,o.matches=ur,o.max=I,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):"_"+arguments[0];return Vr.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=tr(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(!L(n))throw new TypeError;return false===t?e=false:Q(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),U(n,r,{leading:e,maxWait:r,trailing:u}) +},o.times=function(n,r,t){n=0>n?0:n>>>0;var e=-1,u=Array(n);for(r=a(r,t,1);++er?0:r);++nt?Zr(e+t,0):nt(t||0,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=or,o.noConflict=function(){return Nr._=Ir,this},o.now=ht,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+Pr(tt()*(r-n+1))},o.reduce=D,o.reduceRight=W,o.result=function(n,r){if(null!=n){var t=n[r];return L(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"&&-1n.indexOf(";")?n:n.replace(gr,u))},o.uniqueId=function(n){var r=++sr+"";return n?n+r:r},o.all=F,o.any=C,o.detect=M,o.findWhere=M,o.foldl=D,o.foldr=W,o.include=q,o.inject=D,o.first=T,o.last=function(n,r,t){var e=n?n.length:0;return null==r||t?n?n[e-1]:fr:(r=e-r,k(n,0>r?0:r))},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=rr(n)),null==r||t?(r=n?n.length:0,0r?0:+r||0,n.length),n) +},o.take=ot,o.head=T,or(G({},o)),o.VERSION="2.4.1",o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.value=function(){return this.__wrapped__},p("pop push reverse shift sort splice unshift".split(" "),function(n){var r=Rr[n];o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),et.spliceObjects||0!==n.length||delete n[0],this}}),p(["concat","join","slice"],function(n){var r=Rr[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?(Nr._=o, define("underscore",function(){return o})):qr&&Fr?Mr?(Fr.exports=o)._=o:qr._=o:Nr._=o}).call(this); \ No newline at end of file