diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index d9d2f478b..61e4bfe99 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1600,6 +1600,30 @@ return baseForRight(object, callback, keys); } + /** + * The base implementation of `_.functions` which creates a sorted array of + * function property names from those returned by `keysFunc`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Array} Returns the new sorted array of property names. + */ + function baseFunctions(object, keysFunc) { + var index = -1, + props = keysFunc(object), + length = props.length, + result = []; + + while (++index < length) { + var key = props[index]; + if (isFunction(object[key])) { + result.push(key); + } + } + return result.sort(); + } + /** * The base implementation of `_.isEqual`, without support for `thisArg` * binding, that allows partial "_.where" style comparisons. @@ -2969,7 +2993,7 @@ * @example * * var array = [5, 10, 15, 20]; - * var evens = _.removeAt(array, [1, 3]); + * var evens = _.pullAt(array, [1, 3]); * * console.log(array); * // => [5, 15] @@ -2984,8 +3008,8 @@ indexes.sort(baseCompareAscending); while (length--) { - var index = indexes[length]; - if (index != previous) { + var index = parseFloat(indexes[length]); + if (index != previous && index > -1 && index % 1 == 0) { var previous = index; splice.call(array, index, 1); } @@ -4948,8 +4972,8 @@ /** * Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. + * of method names. If no method names are provided all enumerable function + * properties, own and inherited, of `object` will be bound. * * Note: This method does not set the `length` property of bound functions. * @@ -5322,28 +5346,28 @@ * fibonacci(9) * // => 34 * - * var data = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * * // modifying the result cache - * var get = _.memoize(function(name) { return data[name]; }, _.identity); - * get('pebbles'); - * // => { 'name': 'pebbles', 'age': 1 } + * var upperCase = _.memoize(function(string) { + * return string.toUpperCase(); + * }); * - * get.cache.pebbles.name = 'penelope'; - * get('pebbles'); - * // => { 'name': 'penelope', 'age': 1 } + * upperCase('fred'); + * // => 'FRED' + * + * upperCase.cache.fred = 'BARNEY' + * upperCase('fred'); + * // => 'BARNEY' */ function memoize(func, resolver) { if (!isFunction(func) || (resolver && !isFunction(resolver))) { throw new TypeError(funcErrorText); } var memoized = function() { - var cache = memoized.cache, - key = resolver ? resolver.apply(this, arguments) : '_' + arguments[0]; - + var key = resolver ? resolver.apply(this, arguments) : arguments[0]; + if (key == '__proto__') { + return func.apply(this, arguments); + } + var cache = memoized.cache; return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); @@ -6001,8 +6025,8 @@ } /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. + * Creates a sorted array of function property names from all enumerable + * properties, own and inherited, of `object`. * * @static * @memberOf _ @@ -6016,14 +6040,7 @@ * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] */ function functions(object) { - var result = []; - - baseForIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); + return baseFunctions(object, keysIn); } /** @@ -7923,8 +7940,9 @@ } /** - * Adds function properties of a source object to the destination object. - * If `object` is a function methods will be added to its prototype as well. + * Adds all own enumerable function properties of a source object to the + * destination object. If `object` is a function methods will be added to + * its prototype as well. * * @static * @memberOf _ @@ -7956,7 +7974,7 @@ */ function mixin(object, source, options) { var chain = true, - methodNames = source && functions(source); + methodNames = source && baseFunctions(source, keys); if (!source || (!options && !methodNames.length)) { if (options == null) { @@ -7964,7 +7982,7 @@ } source = object; object = this; - methodNames = functions(source); + methodNames = baseFunctions(source, keys); } if (options === false) { chain = false; @@ -8165,7 +8183,7 @@ } if (floating || min % 1 || max % 1) { var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max); + return nativeMin(min + (rand * (max - min + parseFloat('1e-' + (String(rand).length - 1)))), max); } return baseRandom(min, max); } @@ -8502,7 +8520,7 @@ lodash.include = contains; lodash.inject = reduce; - mixin(lodash, function() { + mixin(lodash, (function() { var source = {} baseForOwn(lodash, function(func, methodName) { if (!lodash.prototype[methodName]) { @@ -8510,7 +8528,7 @@ } }); return source; - }(), false); + }()), false); /*--------------------------------------------------------------------------*/ @@ -8523,7 +8541,7 @@ lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; - // add aliases + // add alias lodash.head = first; baseForOwn(lodash, function(func, methodName) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 0c06c1585..3ea1cb76f 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,67 +3,68 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Dr(e);++ri(t,l)&&f.push(l);return f}function wt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1a(s,g)&&((r||f)&&s.push(g),c.push(p))}return c}function Lt(n,t){for(var r=-1,e=t(n),u=e.length,o=Dr(u);++ro?0:o)}function Mt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?ke(u+r,0):r||0;else if(r)return r=Gt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Vt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else o=null==t||r?1:t;return o=e-(o||0),Yt(n,0,0>o?0:o)}function Jt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0; -for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:b;return o=e-(o||0),Yt(n,0>o?0:o)}function Xt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Yt(n,o)}function Yt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=ke(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=ke(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Dr(u);++e>>1,r(n[e])r?0:r);++tr?ke(e+r,0):r||0:0,typeof n=="string"||!ze(n)&&Er(n)?ru&&(u=a)}else t=null==t&&Er(n)?o:U.createCallback(t,r,3),wt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n)});return u}function cr(n,t){return lr(n,zr(t))}function sr(n,t,r,e){var u=3>arguments.length; -if(t=U.createCallback(t,e,4),ze(n)){var o=-1,i=n.length;for(u&&i&&(r=n[++o]);++oarguments.length;return t=U.createCallback(t,e,4),xt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function gr(n){var t=-1,r=n&&n.length,e=Dr(0>r?0:r>>>0);return wt(n,function(n){var r=Nt(0,++t);e[t]=e[r],e[r]=n}),e}function hr(n,t,r){var e;if(t=U.createCallback(t,r,3),ze(n)){r=-1;for(var u=n.length;++rarguments.length)return Pt(n,_,null,t);if(n)var r=n[E]?n[E][2]:n.length,e=Yt(arguments,2),r=r-e.length;return Pt(n,_|j,r,t,e)}function yr(n,t,r){var e,u,o,i,a,l,f,c=0,s=false,p=true;if(!Cr(n))throw new Yr(A);if(t=0>t?0:t,true===r)var g=true,p=false;else jr(r)&&(g=r.leading,s="maxWait"in r&&ke(t,+r.maxWait||0),p="trailing"in r?r.trailing:p);var h=function(){var r=t-(Ke()-i);0>=r||r>t?(u&&ae(u),r=f,u=l=f=b,r&&(c=Ke(),o=n.apply(a,e),l||u||(e=a=null))):l=ve(h,r) -},v=function(){l&&ae(l),u=l=f=b,(p||s!==t)&&(c=Ke(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Ke(),a=this,f=p&&(l||!g),false===s)var r=g&&!l;else{u||g||(c=i);var y=s-(i-c),m=0>=y||y>s;m?(u&&(u=ae(u)),c=i,o=n.apply(a,e)):u||(u=ve(v,y))}return m&&l?l=ae(l):l||t===s||(l=ve(h,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o}}function mr(n){if(!Cr(n))throw new Yr(A);return function(){return!n.apply(this,arguments)}}function dr(n,t,r){var e=arguments;if(!n||2>e.length)return n; -var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,o=e&&n===e.prototype,i=r-1,e=Dr(r),a=0t||null==n||!xe(t))return r;n=Xr(n);do t%2&&(r+=n),t=le(t/2),n+=n;while(t);return r}function Tr(n,t){return(n=null==n?"":Xr(n))?null==t?n.slice(v(n),y(n)+1):(t=Xr(t),n.slice(i(n,t),a(n,t)+1)):n}function Lr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||mt(n,t,r):"object"==e?Fr(n):zr(n)}function Wr(n){return n -}function Fr(n){var t=Be(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||jr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=se.call(e,o)&&It(e[o],n[o],null,true)););return o}:function(n){return n&&se.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function $r(n,t,r){var e=true,u=t&&_r(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=_r(t)),false===r?e=false:jr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=Cr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},U.assign=dr,U.at=function(n){return Ne.unindexedChars&&Er(n)&&(n=n.split("")),t(n,jt(arguments,true,false,1))},U.bind=vr,U.bindAll=function(n){for(var t=1arguments.length?Pt(t,_|w,null,n):Pt(t,_|w|j,null,n,Yt(arguments,2))},U.chain=function(n){return new J(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?u(p,l):i(s,l))){for(t=r;--t;){var g=o[t];if(0>(g?u(g,l):i(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},U.invert=function(n,t){for(var r=-1,e=Be(n),u=e.length,o={};++ro?0:o>>>0);return wt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):b}),i},U.keys=Be,U.keysIn=Ar,U.map=lr,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u)}),e},U.matches=Fr,U.max=fr,U.memoize=function(n,t){if(!Cr(n)||t&&!Cr(t))throw new Yr(A);var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0]; -return se.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0); -for(o||(t=U.createCallback(t,r,3)),wt(n,function(n,r,u){if(o)for(r=t.length,u=Dr(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?f:l);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!Cr(n))throw new Yr(A);return false===r?e=false:jr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,yr(n,t,ft)},U.times=function(n,t,r){n=0>n?0:n>>>0,t=mt(t,r,1),r=-1; -for(var e=Dr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Xr(n).replace(W,p)},U.escapeRegExp=Rr,U.every=er,U.find=or,U.findIndex=Zt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,At,true) -},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,xt)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,St,true)},U.findWhere=function(n,t){return or(n,Fr(t))},U.has=function(n,t){return n?se.call(n,t):false},U.identity=Wr,U.indexOf=Mt,U.isArguments=wr,U.isArray=ze,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ue.call(n)==nt||false -},U.isDate=function(n){return n&&typeof n=="object"&&ue.call(n)==tt||false},U.isElement=xr,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?ke(e+r,0):Oe(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return s._=re,this},U.noop=Pr,U.now=Ke,U.pad=function(n,t,r){n=null==n?"":Xr(n),t=+t; -var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=br({},r,e),n=Xr(null==n?"":n);var u,o,i=br({},r.imports,e.imports),e=Be(i),i=Ir(i),a=0,l=r.interpolate||Z,f="__p+='",l=Jr((r.escape||Z).source+"|"+l.source+"|"+(l===P?z:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); -n.replace(l,function(t,r,e,i,l,c){return e||(e=i),f+=n.slice(a,c).replace(V,g),r&&(u=true,f+="'+__e("+r+")+'"),l&&(o=true,f+="';"+l+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),f+="';",(r=r.variable)||(f="with(obj){"+f+"}"),f=(o?f.replace(R,""):f).replace(N,"$1").replace(T,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=Zr(e,"return "+f).apply(b,i) -}catch(s){throw s.source=f,s}return t?c(t):(c.source=f,c)},U.trim=Tr,U.trimLeft=function(n,t){return(n=null==n?"":Xr(n))?null==t?n.slice(v(n)):(t=Xr(t),n.slice(i(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Xr(n))?null==t?n.slice(0,y(n)+1):(t=Xr(t),n.slice(0,a(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&jr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Xr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Xr(n),r>=n.length)return n; -var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(Or(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Jr(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(L,m))},U.uniqueId=function(n){var t=++S;return Xr(null==n?"":n)+t},U.all=er,U.any=hr,U.detect=or,U.foldl=sr,U.foldr=pr,U.include=rr,U.inject=sr,$r(U,function(){var n={}; -return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Kt,U.last=Jt,U.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Ir(n):Ne.unindexedChars&&Er(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Kt,U.takeRight=Jt,U.takeRightWhile=Jt,U.takeWhile=Kt,U.head=Kt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new J(o,u):o -})}),U.VERSION=O,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=tr,U.prototype.toString=function(){return Xr(this.__wrapped__)},U.prototype.value=tr,U.prototype.valueOf=tr,st(["join","pop","shift"],function(n){var t=Gr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new J(r,n):r}}),st(["push","reverse","sort","unshift"],function(n){var t=Gr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} -}),st(["concat","splice"],function(n){var t=Gr[n];U.prototype[n]=function(){return new J(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Ne.spliceObjects||st(["pop","shift","splice"],function(n){var t=Gr[n],r="splice"==n;U.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new J(u,n):u}}),U}var b,_=1,w=2,x=4,C=8,j=16,k=32,O="2.4.1",E="__lodash@"+O+"__",A="Expected a function",S=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,T=/(__e\(.*?\)|\b__t\))\+'';/g,L=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,P=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,K=/[.*+?^${}()|[\]\/\\]/g,M=/\bthis\b/,V=/['\n\r\u2028\u2029\\]/g,J=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,X=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Y="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),H="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",lt={}; -lt[et]=false,lt[H]=lt[Q]=lt[nt]=lt[tt]=lt[ut]=lt[ot]=lt[it]=lt[at]=true;var ft={leading:false,maxWait:0,trailing:false},ct={configurable:false,enumerable:false,value:null,writable:false},st={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},gt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},ht={"function":true,object:true},vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},yt=ht[typeof window]&&window||this,mt=ht[typeof exports]&&exports&&!exports.nodeType&&exports,ht=ht[typeof module]&&module&&!module.nodeType&&module,dt=mt&&ht&&typeof global=="object"&&global; +;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Br(e);++ra(t,l)&&f.push(l);return f}function wt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1i(s,g)&&((r||f)&&s.push(g),c.push(p))}return c}function Lt(n,t){for(var r=-1,e=t(n),u=e.length,o=Br(u);++ro?0:o)}function Vt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?Oe(u+r,0):r||0;else if(r)return r=Ht(n,t),u&&n[r]===t?r:-1;return e(n,t,r) +}function Jt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else o=null==t||r?1:t;return o=e-(o||0),Gt(n,0,0>o?0:o)}function Xt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:b;return o=e-(o||0),Gt(n,0>o?0:o)}function Yt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Gt(n,o)}function Gt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=Oe(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=Oe(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Br(u);++e>>1,r(n[e])r?0:r);++tr?Oe(e+r,0):r||0:0,typeof n=="string"||!De(n)&&Ar(n)?ru&&(u=i)}else t=null==t&&Ar(n)?o:U.createCallback(t,r,3),wt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n) +});return u}function sr(n,t){return fr(n,Dr(t))}function pr(n,t,r,e){var u=3>arguments.length;if(t=U.createCallback(t,e,4),De(n)){var o=-1,a=n.length;for(u&&a&&(r=n[++o]);++oarguments.length;return t=U.createCallback(t,e,4),xt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function hr(n){var t=-1,r=n&&n.length,e=Br(0>r?0:r>>>0);return wt(n,function(n){var r=Tt(0,++t);e[t]=e[r],e[r]=n}),e}function vr(n,t,r){var e; +if(t=U.createCallback(t,r,3),De(n)){r=-1;for(var u=n.length;++rarguments.length)return zt(n,_,null,t);if(n)var r=n[E]?n[E][2]:n.length,e=Gt(arguments,2),r=r-e.length;return zt(n,_|j,r,t,e)}function mr(n,t,r){var e,u,o,a,i,l,f,c=0,s=false,p=true;if(!jr(n))throw new Gr(A);if(t=0>t?0:t,true===r)var g=true,p=false;else kr(r)&&(g=r.leading,s="maxWait"in r&&Oe(t,+r.maxWait||0),p="trailing"in r?r.trailing:p); +var h=function(){var r=t-(Me()-a);0>=r||r>t?(u&&le(u),r=f,u=l=f=b,r&&(c=Me(),o=n.apply(i,e),l||u||(e=i=null))):l=ye(h,r)},v=function(){l&&le(l),u=l=f=b,(p||s!==t)&&(c=Me(),o=n.apply(i,e),l||u||(e=i=null))};return function(){if(e=arguments,a=Me(),i=this,f=p&&(l||!g),false===s)var r=g&&!l;else{u||g||(c=a);var y=s-(a-c),m=0>=y||y>s;m?(u&&(u=le(u)),c=a,o=n.apply(i,e)):u||(u=ye(v,y))}return m&&l?l=le(l):l||t===s||(l=ye(h,t)),r&&(m=true,o=n.apply(i,e)),!m||l||u||(e=i=null),o}}function dr(n){if(!jr(n))throw new Gr(A); +return function(){return!n.apply(this,arguments)}}function br(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,a=typeof r;if("number"!=a&&"string"!=a||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,o=e&&n===e.prototype,a=r-1,e=Br(r),i=0t||null==n||!Ce(t))return r;n=Yr(n);do t%2&&(r+=n),t=fe(t/2),n+=n;while(t); +return r}function Fr(n,t){return(n=null==n?"":Yr(n))?null==t?n.slice(v(n),y(n)+1):(t=Yr(t),n.slice(a(n,t),i(n,t)+1)):n}function Lr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||mt(n,t,r):"object"==e?$r(n):Dr(n)}function Wr(n){return n}function $r(n){var t=qe(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||kr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=pe.call(e,o)&&Rt(e[o],n[o],null,true)););return o}:function(n){return n&&pe.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false +}}function Pr(n,t,r){var e=true,u=t&&It(t,qe);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=It(t,qe)),false===r?e=false:kr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=jr(n),a=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},U.assign=br,U.at=function(n){return Te.unindexedChars&&Ar(n)&&(n=n.split("")),t(n,jt(arguments,true,false,1))},U.bind=yr,U.bindAll=function(n){for(var t=1arguments.length?zt(t,_|w,null,n):zt(t,_|w|j,null,n,Gt(arguments,2))},U.chain=function(n){return new J(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?u(p,l):a(s,l))){for(t=r;--t;){var g=o[t];if(0>(g?u(g,l):a(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},U.invert=function(n,t){for(var r=-1,e=qe(n),u=e.length,o={};++ro?0:o>>>0);return wt(n,function(n){var o=u?t:null!=n&&n[t];a[++e]=o?o.apply(n,r):b}),a},U.keys=qe,U.keysIn=Sr,U.map=fr,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u)}),e},U.matches=$r,U.max=cr,U.memoize=function(n,t){if(!jr(n)||t&&!jr(t))throw new Gr(A);var r=function(){var e=t?t.apply(this,arguments):arguments[0]; +if("__proto__"==e)return n.apply(this,arguments);var u=r.cache;return pe.call(u,e)?u[e]:u[e]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0); +for(o||(t=U.createCallback(t,r,3)),wt(n,function(n,r,u){if(o)for(r=t.length,u=Br(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);a[++e]={a:u,b:e,c:n}}),u=a.length,a.sort(o?f:l);u--;)a[u]=a[u].c;return a},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!jr(n))throw new Gr(A);return false===r?e=false:kr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,mr(n,t,ft)},U.times=function(n,t,r){n=0>n?0:n>>>0,t=mt(t,r,1),r=-1; +for(var e=Br(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Yr(n).replace(L,p)},U.escapeRegExp=Nr,U.every=ur,U.find=ar,U.findIndex=Kt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,At,true) +},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,xt)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,St,true)},U.findWhere=function(n,t){return ar(n,$r(t))},U.has=function(n,t){return n?pe.call(n,t):false},U.identity=Wr,U.indexOf=Vt,U.isArguments=xr,U.isArray=De,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&oe.call(n)==nt||false +},U.isDate=function(n){return n&&typeof n=="object"&&oe.call(n)==tt||false},U.isElement=Cr,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?Oe(e+r,0):Ee(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return s._=ee,this},U.noop=zr,U.now=Me,U.pad=function(n,t,r){n=null==n?"":Yr(n),t=+t; +var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=_r({},r,e),n=Yr(null==n?"":n);var u,o,a=_r({},r.imports,e.imports),e=qe(a),a=Rr(a),i=0,l=r.interpolate||Z,f="__p+='",l=Xr((r.escape||Z).source+"|"+l.source+"|"+(l===P?z:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); +n.replace(l,function(t,r,e,a,l,c){return e||(e=a),f+=n.slice(i,c).replace(V,g),r&&(u=true,f+="'+__e("+r+")+'"),l&&(o=true,f+="';"+l+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';",(r=r.variable)||(f="with(obj){"+f+"}"),f=(o?f.replace(R,""):f).replace(N,"$1").replace(T,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=Kr(e,"return "+f).apply(b,a) +}catch(s){throw s.source=f,s}return t?c(t):(c.source=f,c)},U.trim=Fr,U.trimLeft=function(n,t){return(n=null==n?"":Yr(n))?null==t?n.slice(v(n)):(t=Yr(t),n.slice(a(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Yr(n))?null==t?n.slice(0,y(n)+1):(t=Yr(t),n.slice(0,i(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&kr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Yr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Yr(n),r>=n.length)return n; +var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(Er(u)){if(n.slice(o).search(u)){var a,i,l=n.slice(0,o);for(u.global||(u=Xr(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;a=u.exec(l);)i=a.index;r=r.slice(0,null==i?o:i)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(F,m))},U.uniqueId=function(n){var t=++S;return Yr(null==n?"":n)+t},U.all=ur,U.any=vr,U.detect=ar,U.foldl=pr,U.foldr=gr,U.include=er,U.inject=pr,Pr(U,function(){var n={}; +return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Mt,U.last=Xt,U.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Rr(n):Te.unindexedChars&&Ar(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Mt,U.takeRight=Xt,U.takeRightWhile=Xt,U.takeWhile=Mt,U.head=Mt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new J(o,u):o +})}),U.VERSION=O,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=rr,U.prototype.toString=function(){return Yr(this.__wrapped__)},U.prototype.value=rr,U.prototype.valueOf=rr,st(["join","pop","shift"],function(n){var t=Hr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new J(r,n):r}}),st(["push","reverse","sort","unshift"],function(n){var t=Hr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} +}),st(["concat","splice"],function(n){var t=Hr[n];U.prototype[n]=function(){return new J(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Te.spliceObjects||st(["pop","shift","splice"],function(n){var t=Hr[n],r="splice"==n;U.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new J(u,n):u}}),U}var b,_=1,w=2,x=4,C=8,j=16,k=32,O="2.4.1",E="__lodash@"+O+"__",A="Expected a function",S=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,T=/(__e\(.*?\)|\b__t\))\+'';/g,F=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,W=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,P=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,K=/[.*+?^${}()|[\]\/\\]/g,M=/\bthis\b/,V=/['\n\r\u2028\u2029\\]/g,J=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,X=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Y="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),H="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",at="[object RegExp]",it="[object String]",lt={}; +lt[et]=false,lt[H]=lt[Q]=lt[nt]=lt[tt]=lt[ut]=lt[ot]=lt[at]=lt[it]=true;var ft={leading:false,maxWait:0,trailing:false},ct={configurable:false,enumerable:false,value:null,writable:false},st={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},gt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},ht={"function":true,object:true},vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},yt=ht[typeof window]&&window||this,mt=ht[typeof exports]&&exports&&!exports.nodeType&&exports,ht=ht[typeof module]&&module&&!module.nodeType&&module,dt=mt&&ht&&typeof global=="object"&&global; !dt||dt.global!==dt&&dt.window!==dt&&dt.self!==dt||(yt=dt);var dt=ht&&ht.exports===mt&&mt,bt=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yt._=bt, define(function(){return bt})):mt&&ht?dt?(ht.exports=bt)._=bt:mt._=bt:yt._=bt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index eb914d1a4..b0b568a55 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -1436,6 +1436,30 @@ return baseForRight(object, callback, keys); } + /** + * The base implementation of `_.functions` which creates a sorted array of + * function property names from those returned by `keysFunc`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Array} Returns the new sorted array of property names. + */ + function baseFunctions(object, keysFunc) { + var index = -1, + props = keysFunc(object), + length = props.length, + result = []; + + while (++index < length) { + var key = props[index]; + if (isFunction(object[key])) { + result.push(key); + } + } + return result.sort(); + } + /** * The base implementation of `_.isEqual`, without support for `thisArg` * binding, that allows partial "_.where" style comparisons. @@ -2788,7 +2812,7 @@ * @example * * var array = [5, 10, 15, 20]; - * var evens = _.removeAt(array, [1, 3]); + * var evens = _.pullAt(array, [1, 3]); * * console.log(array); * // => [5, 15] @@ -2803,8 +2827,8 @@ indexes.sort(baseCompareAscending); while (length--) { - var index = indexes[length]; - if (index != previous) { + var index = parseFloat(indexes[length]); + if (index != previous && index > -1 && index % 1 == 0) { var previous = index; splice.call(array, index, 1); } @@ -4769,8 +4793,8 @@ /** * Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. + * of method names. If no method names are provided all enumerable function + * properties, own and inherited, of `object` will be bound. * * Note: This method does not set the `length` property of bound functions. * @@ -5143,28 +5167,28 @@ * fibonacci(9) * // => 34 * - * var data = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * * // modifying the result cache - * var get = _.memoize(function(name) { return data[name]; }, _.identity); - * get('pebbles'); - * // => { 'name': 'pebbles', 'age': 1 } + * var upperCase = _.memoize(function(string) { + * return string.toUpperCase(); + * }); * - * get.cache.pebbles.name = 'penelope'; - * get('pebbles'); - * // => { 'name': 'penelope', 'age': 1 } + * upperCase('fred'); + * // => 'FRED' + * + * upperCase.cache.fred = 'BARNEY' + * upperCase('fred'); + * // => 'BARNEY' */ function memoize(func, resolver) { if (!isFunction(func) || (resolver && !isFunction(resolver))) { throw new TypeError(funcErrorText); } var memoized = function() { - var cache = memoized.cache, - key = resolver ? resolver.apply(this, arguments) : '_' + arguments[0]; - + var key = resolver ? resolver.apply(this, arguments) : arguments[0]; + if (key == '__proto__') { + return func.apply(this, arguments); + } + var cache = memoized.cache; return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); @@ -5822,8 +5846,8 @@ } /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. + * Creates a sorted array of function property names from all enumerable + * properties, own and inherited, of `object`. * * @static * @memberOf _ @@ -5837,14 +5861,7 @@ * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] */ function functions(object) { - var result = []; - - baseForIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); + return baseFunctions(object, keysIn); } /** @@ -7707,8 +7724,9 @@ } /** - * Adds function properties of a source object to the destination object. - * If `object` is a function methods will be added to its prototype as well. + * Adds all own enumerable function properties of a source object to the + * destination object. If `object` is a function methods will be added to + * its prototype as well. * * @static * @memberOf _ @@ -7740,7 +7758,7 @@ */ function mixin(object, source, options) { var chain = true, - methodNames = source && functions(source); + methodNames = source && baseFunctions(source, keys); if (!source || (!options && !methodNames.length)) { if (options == null) { @@ -7748,7 +7766,7 @@ } source = object; object = this; - methodNames = functions(source); + methodNames = baseFunctions(source, keys); } if (options === false) { chain = false; @@ -7949,7 +7967,7 @@ } if (floating || min % 1 || max % 1) { var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max); + return nativeMin(min + (rand * (max - min + parseFloat('1e-' + (String(rand).length - 1)))), max); } return baseRandom(min, max); } @@ -8286,7 +8304,7 @@ lodash.include = contains; lodash.inject = reduce; - mixin(lodash, function() { + mixin(lodash, (function() { var source = {} baseForOwn(lodash, function(func, methodName) { if (!lodash.prototype[methodName]) { @@ -8294,7 +8312,7 @@ } }); return source; - }(), false); + }()), false); /*--------------------------------------------------------------------------*/ @@ -8307,7 +8325,7 @@ lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; - // add aliases + // add alias lodash.head = first; baseForOwn(lodash, function(func, methodName) { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index a2357273a..f77af7c97 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -5,62 +5,62 @@ */ ;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Dr(e);++ri(t,f)&&l.push(f);return l}function bt(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number"&&-1a(p,h)&&((r||l)&&p.push(h),c.push(s))}return c}function St(n,t){for(var r=-1,e=t(n),u=e.length,o=Dr(u);++ro?0:o)}function Pt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?we(u+r,0):r||0;else if(r)return r=Xt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Kt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++ -}else o=null==t||r?1:t;return o=e-(o||0),Jt(n,0,0>o?0:o)}function Mt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:d;return o=e-(o||0),Jt(n,0>o?0:o)}function Vt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Jt(n,o)}function Jt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=we(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=we(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Dr(u);++e>>1,r(n[e])r?0:r);++tr?we(e+r,0):r||0:0,typeof n=="string"||!We(n)&&Cr(n)?ru&&(u=a)}else t=null==t&&Cr(n)?o:U.createCallback(t,r,3),bt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n)});return u}function fr(n,t){return ir(n,zr(t))}function lr(n,t,r,e){var u=3>arguments.length;t=U.createCallback(t,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return t=U.createCallback(t,e,4),_t(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o) -}),r}function pr(n){var t=-1,r=n&&n.length,e=Dr(0>r?0:r>>>0);return bt(n,function(n){var r=Rt(0,++t);e[t]=e[r],e[r]=n}),e}function sr(n,t,r){var e;t=U.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return $t(n,b,null,t);if(n)var r=n[A]?n[A][2]:n.length,e=Jt(arguments,2),r=r-e.length;return $t(n,b|k,r,t,e)}function gr(n,t,r){var e,u,o,i,a,f,l,c=0,p=false,s=true; -if(!wr(n))throw new Vr(O);if(t=0>t?0:t,true===r)var h=true,s=false;else jr(r)&&(h=r.leading,p="maxWait"in r&&we(t,+r.maxWait||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(Be()-i);0>=r||r>t?(u&&ee(u),r=l,u=f=l=d,r&&(c=Be(),o=n.apply(a,e),f||u||(e=a=null))):f=pe(g,r)},v=function(){f&&ee(f),u=f=l=d,(s||p!==t)&&(c=Be(),o=n.apply(a,e),f||u||(e=a=null))};return function(){if(e=arguments,i=Be(),a=this,l=s&&(f||!h),false===p)var r=h&&!f;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=ee(u)),c=i,o=n.apply(a,e)):u||(u=pe(v,y)) -}return m&&f?f=ee(f):f||t===p||(f=pe(g,t)),r&&(m=true,o=n.apply(a,e)),!m||f||u||(e=a=null),o}}function vr(n){if(!wr(n))throw new Vr(O);return function(){return!n.apply(this,arguments)}}function yr(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=Dr(r),a=0t||null==n||!de(t))return r;n=Mr(n);do t%2&&(r+=n),t=ue(t/2),n+=n;while(t);return r}function Nr(n,t){return(n=null==n?"":Mr(n))?null==t?n.slice(g(n),v(n)+1):(t=Mr(t),n.slice(i(n,t),a(n,t)+1)):n -}function Sr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||vt(n,t,r):"object"==e?Wr(n):zr(n)}function Tr(n){return n}function Wr(n){var t=$e(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||jr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=ae.call(e,o)&&Et(e[o],n[o],null,true)););return o}:function(n){return n&&ae.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function Fr(n,t,r){var e=true,u=t&&dr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=dr(t)),false===r?e=false:jr(r)&&"chain"in r&&(e=r.chain),r=-1; -for(var o=wr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0 -}},U.assign=yr,U.at=function(n){return t(n,jt(arguments,true,false,1))},U.bind=hr,U.bindAll=function(n){for(var t=1arguments.length?$t(t,b|_,null,n):$t(t,b|_|k,null,n,Jt(arguments,2))},U.chain=function(n){return new V(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(s?u(s,f):i(p,f))){for(t=r;--t;){var h=o[t]; -if(0>(h?u(h,f):i(n[t],f)))continue n}s&&s.push(f),p.push(f)}return p},U.invert=function(n,t){for(var r=-1,e=$e(n),u=e.length,o={};++ro?0:o>>>0);return bt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):d}),i},U.keys=$e,U.keysIn=Ar,U.map=ir,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u) -}),e},U.matches=Wr,U.max=ar,U.memoize=function(n,t){if(!wr(n)||t&&!wr(t))throw new Vr(O);var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return ae.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(o||(t=U.createCallback(t,r,3)),bt(n,function(n,r,u){if(o)for(r=t.length,u=Dr(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?l:f);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!wr(n))throw new Vr(O);return false===r?e=false:jr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),at.leading=e,at.maxWait=+t,at.trailing=u,gr(n,t,at) -},U.times=function(n,t,r){n=0>n?0:n>>>0,t=vt(t,r,1),r=-1;for(var e=Dr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Mr(n).replace(W,s)},U.escapeRegExp=Ir,U.every=tr,U.find=er,U.findIndex=Ut,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,At,true) -},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,_t)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,Ot,true)},U.findWhere=function(n,t){return er(n,Wr(t))},U.has=function(n,t){return n?ae.call(n,t):false},U.identity=Tr,U.indexOf=Pt,U.isArguments=br,U.isArray=We,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ne.call(n)==H||false -},U.isDate=function(n){return n&&typeof n=="object"&&ne.call(n)==Q||false},U.isElement=_r,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?we(e+r,0):je(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return p._=Hr,this},U.noop=$r,U.now=Be,U.pad=function(n,t,r){n=null==n?"":Mr(n),t=+t; -var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=mr({},r,e),n=Mr(null==n?"":n);var u,o,i=mr({},r.imports,e.imports),e=$e(i),i=Er(i),a=0,f=r.interpolate||Z,l="__p+='",f=Kr((r.escape||Z).source+"|"+f.source+"|"+(f===z?D:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); -n.replace(f,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(M,h),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(r=r.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(R,""):l).replace(N,"$1").replace(S,"$1;"),l="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=qr(e,"return "+l).apply(d,i) -}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},U.trim=Nr,U.trimLeft=function(n,t){return(n=null==n?"":Mr(n))?null==t?n.slice(g(n)):(t=Mr(t),n.slice(i(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Mr(n))?null==t?n.slice(0,v(n)+1):(t=Mr(t),n.slice(0,a(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&jr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Mr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Mr(n),r>=n.length)return n; -var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(xr(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Kr(u.source,(L.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,y))},U.uniqueId=function(n){var t=++E;return Mr(null==n?"":n)+t},U.all=tr,U.any=sr,U.detect=er,U.foldl=lr,U.foldr=cr,U.include=nr,U.inject=lr,Fr(U,function(){var n={}; -return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Zt,U.last=Mt,U.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=Er(n)),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Zt,U.takeRight=Mt,U.takeRightWhile=Mt,U.takeWhile=Zt,U.head=Zt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new V(o,u):o -})}),U.VERSION=C,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=Qt,U.prototype.toString=function(){return Mr(this.__wrapped__)},U.prototype.value=Qt,U.prototype.valueOf=Qt,lt(["join","pop","shift"],function(n){var t=Jr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),lt(["push","reverse","sort","unshift"],function(n){var t=Jr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} -}),lt(["concat","splice"],function(n){var t=Jr[n];U.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments),this.__chain__)}}),U}var d,b=1,_=2,w=4,j=8,k=16,x=32,C="2.4.1",A="__lodash@"+C+"__",O="Expected a function",E=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,S=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,L=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,P=/[.*+?^${}()|[\]\/\\]/g,K=/\bthis\b/,M=/['\n\r\u2028\u2029\\]/g,V=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,J=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",X="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="[object Arguments]",G="[object Array]",H="[object Boolean]",Q="[object Date]",nt="[object Error]",tt="[object Function]",rt="[object Number]",et="[object Object]",ut="[object RegExp]",ot="[object String]",it={}; +}return t}function v(n){for(var t=n.length;t--;){var r=n.charCodeAt(t);if((160r||13r||8202>>0:0,u=Lr(e);++ri(t,f)&&l.push(f);return l}function bt(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number"&&-1a(p,h)&&((r||l)&&p.push(h),c.push(s))}return c}function Tt(n,t){for(var r=-1,e=t(n),u=e.length,o=Lr(u);++ro?0:o)}function Kt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?je(u+r,0):r||0;else if(r)return r=Yt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Mt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++ +}else o=null==t||r?1:t;return o=e-(o||0),Xt(n,0,0>o?0:o)}function Vt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:d;return o=e-(o||0),Xt(n,0>o?0:o)}function Jt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Xt(n,o)}function Xt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=je(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=je(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Lr(u);++e>>1,r(n[e])r?0:r);++tr?je(e+r,0):r||0:0,typeof n=="string"||!We(n)&&Ar(n)?ru&&(u=a)}else t=null==t&&Ar(n)?o:U.createCallback(t,r,3),bt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n)});return u}function lr(n,t){return ar(n,Dr(t))}function cr(n,t,r,e){var u=3>arguments.length;t=U.createCallback(t,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return t=U.createCallback(t,e,4),_t(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o) +}),r}function sr(n){var t=-1,r=n&&n.length,e=Lr(0>r?0:r>>>0);return bt(n,function(n){var r=Nt(0,++t);e[t]=e[r],e[r]=n}),e}function hr(n,t,r){var e;t=U.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return zt(n,b,null,t);if(n)var r=n[A]?n[A][2]:n.length,e=Xt(arguments,2),r=r-e.length;return zt(n,b|k,r,t,e)}function vr(n,t,r){var e,u,o,i,a,f,l,c=0,p=false,s=true; +if(!jr(n))throw new Jr(O);if(t=0>t?0:t,true===r)var h=true,s=false;else kr(r)&&(h=r.leading,p="maxWait"in r&&je(t,+r.maxWait||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(qe()-i);0>=r||r>t?(u&&ue(u),r=l,u=f=l=d,r&&(c=qe(),o=n.apply(a,e),f||u||(e=a=null))):f=se(g,r)},v=function(){f&&ue(f),u=f=l=d,(s||p!==t)&&(c=qe(),o=n.apply(a,e),f||u||(e=a=null))};return function(){if(e=arguments,i=qe(),a=this,l=s&&(f||!h),false===p)var r=h&&!f;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=ue(u)),c=i,o=n.apply(a,e)):u||(u=se(v,y)) +}return m&&f?f=ue(f):f||t===p||(f=se(g,t)),r&&(m=true,o=n.apply(a,e)),!m||f||u||(e=a=null),o}}function yr(n){if(!jr(n))throw new Jr(O);return function(){return!n.apply(this,arguments)}}function mr(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=Lr(r),a=0t||null==n||!be(t))return r;n=Vr(n);do t%2&&(r+=n),t=oe(t/2),n+=n;while(t);return r}function Sr(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(g(n),v(n)+1):(t=Vr(t),n.slice(i(n,t),a(n,t)+1)):n}function Tr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||vt(n,t,r):"object"==e?Wr(n):Dr(n) +}function Fr(n){return n}function Wr(n){var t=ze(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||kr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=fe.call(e,o)&&It(e[o],n[o],null,true)););return o}:function(n){return n&&fe.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function $r(n,t,r){var e=true,u=t&&Et(t,ze);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=Et(t,ze)),false===r?e=false:kr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=jr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0 +}},U.assign=mr,U.at=function(n){return t(n,jt(arguments,true,false,1))},U.bind=gr,U.bindAll=function(n){for(var t=1arguments.length?zt(t,b|_,null,n):zt(t,b|_|k,null,n,Xt(arguments,2))},U.chain=function(n){return new V(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(s?u(s,f):i(p,f))){for(t=r;--t;){var h=o[t]; +if(0>(h?u(h,f):i(n[t],f)))continue n}s&&s.push(f),p.push(f)}return p},U.invert=function(n,t){for(var r=-1,e=ze(n),u=e.length,o={};++ro?0:o>>>0);return bt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):d}),i},U.keys=ze,U.keysIn=Or,U.map=ar,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u) +}),e},U.matches=Wr,U.max=fr,U.memoize=function(n,t){if(!jr(n)||t&&!jr(t))throw new Jr(O);var r=function(){var e=t?t.apply(this,arguments):arguments[0];if("__proto__"==e)return n.apply(this,arguments);var u=r.cache;return fe.call(u,e)?u[e]:u[e]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(o||(t=U.createCallback(t,r,3)),bt(n,function(n,r,u){if(o)for(r=t.length,u=Lr(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?l:f);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!jr(n))throw new Jr(O);return false===r?e=false:kr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),at.leading=e,at.maxWait=+t,at.trailing=u,vr(n,t,at) +},U.times=function(n,t,r){n=0>n?0:n>>>0,t=vt(t,r,1),r=-1;for(var e=Lr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Vr(n).replace(F,s)},U.escapeRegExp=Rr,U.every=rr,U.find=ur,U.findIndex=Zt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,At,true) +},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,_t)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,Ot,true)},U.findWhere=function(n,t){return ur(n,Wr(t))},U.has=function(n,t){return n?fe.call(n,t):false},U.identity=Fr,U.indexOf=Kt,U.isArguments=_r,U.isArray=We,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&te.call(n)==H||false +},U.isDate=function(n){return n&&typeof n=="object"&&te.call(n)==Q||false},U.isElement=wr,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?je(e+r,0):ke(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return p._=Qr,this},U.noop=zr,U.now=qe,U.pad=function(n,t,r){n=null==n?"":Vr(n),t=+t; +var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=dr({},r,e),n=Vr(null==n?"":n);var u,o,i=dr({},r.imports,e.imports),e=ze(i),i=Ir(i),a=0,f=r.interpolate||Z,l="__p+='",f=Mr((r.escape||Z).source+"|"+f.source+"|"+(f===z?D:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); +n.replace(f,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(M,h),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(r=r.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(R,""):l).replace(N,"$1").replace(S,"$1;"),l="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=Ur(e,"return "+l).apply(d,i) +}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},U.trim=Sr,U.trimLeft=function(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(g(n)):(t=Vr(t),n.slice(i(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(0,v(n)+1):(t=Vr(t),n.slice(0,a(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&kr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Vr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Vr(n),r>=n.length)return n; +var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(Cr(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Mr(u.source,(L.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,y))},U.uniqueId=function(n){var t=++E;return Vr(null==n?"":n)+t},U.all=rr,U.any=hr,U.detect=ur,U.foldl=cr,U.foldr=pr,U.include=tr,U.inject=cr,$r(U,function(){var n={}; +return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Pt,U.last=Vt,U.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=Ir(n)),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Pt,U.takeRight=Vt,U.takeRightWhile=Vt,U.takeWhile=Pt,U.head=Pt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new V(o,u):o +})}),U.VERSION=C,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=nr,U.prototype.toString=function(){return Vr(this.__wrapped__)},U.prototype.value=nr,U.prototype.valueOf=nr,lt(["join","pop","shift"],function(n){var t=Xr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),lt(["push","reverse","sort","unshift"],function(n){var t=Xr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} +}),lt(["concat","splice"],function(n){var t=Xr[n];U.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments),this.__chain__)}}),U}var d,b=1,_=2,w=4,j=8,k=16,x=32,C="2.4.1",A="__lodash@"+C+"__",O="Expected a function",E=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,S=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,W=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,L=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,P=/[.*+?^${}()|[\]\/\\]/g,K=/\bthis\b/,M=/['\n\r\u2028\u2029\\]/g,V=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,J=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",X="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="[object Arguments]",G="[object Array]",H="[object Boolean]",Q="[object Date]",nt="[object Error]",tt="[object Function]",rt="[object Number]",et="[object Object]",ut="[object RegExp]",ot="[object String]",it={}; it[tt]=false,it[Y]=it[G]=it[H]=it[Q]=it[rt]=it[et]=it[ut]=it[ot]=true;var at={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},lt={"&":"&","<":"<",">":">",'"':""","'":"'"},ct={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},st={"function":true,object:true},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},gt=st[typeof window]&&window||this,vt=st[typeof exports]&&exports&&!exports.nodeType&&exports,st=st[typeof module]&&module&&!module.nodeType&&module,yt=vt&&st&&typeof global=="object"&&global; !yt||yt.global!==yt&&yt.window!==yt&&yt.self!==yt||(gt=yt);var yt=st&&st.exports===vt&&vt,mt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gt._=mt, define(function(){return mt})):vt&&st?yt?(st.exports=mt)._=mt:vt._=mt:gt._=mt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index aaf23e308..e8b84665a 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -807,6 +807,30 @@ return baseForRight(object, callback, keys); } + /** + * The base implementation of `_.functions` which creates a sorted array of + * function property names from those returned by `keysFunc`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Array} Returns the new sorted array of property names. + */ + function baseFunctions(object, keysFunc) { + var index = -1, + props = keysFunc(object), + length = props.length, + result = []; + + while (++index < length) { + var key = props[index]; + if (isFunction(object[key])) { + result.push(key); + } + } + return result.sort(); + } + /** * The base implementation of `_.isEqual`, without support for `thisArg` * binding, that allows partial "_.where" style comparisons. @@ -3200,8 +3224,8 @@ /** * Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. + * of method names. If no method names are provided all enumerable function + * properties, own and inherited, of `object` will be bound. * * Note: This method does not set the `length` property of bound functions. * @@ -3496,19 +3520,17 @@ * fibonacci(9) * // => 34 * - * var data = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * * // modifying the result cache - * var get = _.memoize(function(name) { return data[name]; }, _.identity); - * get('pebbles'); - * // => { 'name': 'pebbles', 'age': 1 } + * var upperCase = _.memoize(function(string) { + * return string.toUpperCase(); + * }); * - * get.cache.pebbles.name = 'penelope'; - * get('pebbles'); - * // => { 'name': 'penelope', 'age': 1 } + * upperCase('fred'); + * // => 'FRED' + * + * upperCase.cache.fred = 'BARNEY' + * upperCase('fred'); + * // => 'BARNEY' */ function memoize(func, resolver) { if (!isFunction(func) || (resolver && !isFunction(resolver))) { @@ -3516,7 +3538,10 @@ } var cache = {}; return function() { - var key = resolver ? resolver.apply(this, arguments) : '_' + arguments[0]; + var key = resolver ? resolver.apply(this, arguments) : arguments[0]; + if (key == '__proto__') { + return func.apply(this, arguments); + } return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); @@ -3836,8 +3861,8 @@ } /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. + * Creates a sorted array of function property names from all enumerable + * properties, own and inherited, of `object`. * * @static * @memberOf _ @@ -3851,14 +3876,7 @@ * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] */ function functions(object) { - var result = []; - - baseForIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); + return baseFunctions(object, keysIn); } /** @@ -4874,8 +4892,9 @@ } /** - * Adds function properties of a source object to the destination object. - * If `object` is a function methods will be added to its prototype as well. + * Adds all own enumerable function properties of a source object to the + * destination object. If `object` is a function methods will be added to + * its prototype as well. * * @static * @memberOf _ @@ -5312,7 +5331,7 @@ lodash.sample = sample; lodash.take = take; - // add aliases + // add alias lodash.head = first; /*--------------------------------------------------------------------------*/ @@ -5333,36 +5352,36 @@ lodash.prototype.chain = wrapperChain; lodash.prototype.value = wrapperValueOf; - // add `Array` mutator functions to the wrapper - arrayEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; - lodash.prototype[methodName] = function() { - var value = this.__wrapped__; - func.apply(value, arguments); + // add `Array` mutator functions to the wrapper + arrayEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { + var func = arrayRef[methodName]; + lodash.prototype[methodName] = function() { + var value = this.__wrapped__; + func.apply(value, arguments); - // avoid array-like object bugs with `Array#shift` and `Array#splice` - // in Firefox < 10 and IE < 9 - if (!support.spliceObjects && value.length === 0) { - delete value[0]; - } - return this; - }; - }); + // avoid array-like object bugs with `Array#shift` and `Array#splice` + // in Firefox < 10 and IE < 9 + if (!support.spliceObjects && value.length === 0) { + delete value[0]; + } + return this; + }; + }); - // add `Array` accessor functions to the wrapper - arrayEach(['concat', 'join', 'slice'], function(methodName) { - var func = arrayRef[methodName]; - lodash.prototype[methodName] = function() { - var value = this.__wrapped__, - result = func.apply(value, arguments); + // add `Array` accessor functions to the wrapper + arrayEach(['concat', 'join', 'slice'], function(methodName) { + var func = arrayRef[methodName]; + lodash.prototype[methodName] = function() { + var value = this.__wrapped__, + result = func.apply(value, arguments); - if (this.__chain__) { - result = new lodashWrapper(result); - result.__chain__ = true; - } - return result; - }; - }); + if (this.__chain__) { + result = new lodashWrapper(result); + result.__chain__ = true; + } + return result; + }; + }); /*--------------------------------------------------------------------------*/ diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 1d369098e..9b3b9c813 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -18,17 +18,18 @@ r=or(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length;return r=or(r,e,4),h(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function U(n){var r=-1,t=n&&n.length,e=Array(0>t?0:t>>>0);return g(n,function(n){var t=_(++r);e[r]=e[t],e[t]=n}),e}function V(n,r,t){var e;r=or(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length?x(n,pr,r):x(n,pr|gr,r,N(arguments,2))}function H(n,r,t){function e(){l&&clearTimeout(l),i=l=p=lr,(h||g!==r)&&(s=yt(),f=n.apply(c,o),l||i||(o=c=null))}function u(){var t=r-(yt()-a);0>=t||t>r?(i&&clearTimeout(i),t=p,i=l=p=lr,t&&(s=yt(),f=n.apply(c,o),l||i||(o=c=null))):l=setTimeout(u,t)}var o,i,f,a,c,l,p,s=0,g=false,h=true;if(!Y(n))throw new TypeError(vr);if(r=0>r?0:r,true===t)var v=true,h=false;else Z(t)&&(v=t.leading,g="maxWait"in t&&et(r,+t.maxWait||0),h="trailing"in t?t.trailing:h); return function(){if(o=arguments,a=yt(),c=this,p=h&&(l||!v),false===g)var t=v&&!l;else{i||v||(s=a);var y=g-(a-s),m=0>=y||y>g;m?(i&&(i=clearTimeout(i)),s=a,f=n.apply(c,o)):i||(i=setTimeout(e,y))}return m&&l?l=clearTimeout(l):l||r===g||(l=setTimeout(u,r)),t&&(m=true,f=n.apply(c,o)),!m||l||i||(o=c=null),f}}function J(n){if(!Y(n))throw new TypeError(vr);return function(){return!n.apply(this,arguments)}}function K(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t;for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,dr=/($^)/,_r=/[.*+?^${}()|[\]\/\\]/g,wr=/['\n\r\u2028\u2029\\]/g,jr="[object Arguments]",xr="[object Array]",Tr="[object Boolean]",Ar="[object Date]",Er="[object Number]",Or="[object Object]",kr="[object RegExp]",Sr="[object String]",Nr={"&":"&","<":"<",">":">",'"':""","'":"'"},qr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Fr={"function":true,object:true},Br={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mr=Fr[typeof window]&&window||this,Rr=Fr[typeof exports]&&exports&&!exports.nodeType&&exports,$r=Fr[typeof module]&&module&&!module.nodeType&&module,Ir=Rr&&$r&&typeof global=="object"&&global; +for(var f in r)n[f]=r[f]}return n}function L(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t;for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,dr=/($^)/,_r=/[.*+?^${}()|[\]\/\\]/g,wr=/['\n\r\u2028\u2029\\]/g,jr="[object Arguments]",xr="[object Array]",Tr="[object Boolean]",Ar="[object Date]",Er="[object Number]",Or="[object Object]",kr="[object RegExp]",Sr="[object String]",Nr={"&":"&","<":"<",">":">",'"':""","'":"'"},qr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Fr={"function":true,object:true},Br={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mr=Fr[typeof window]&&window||this,Rr=Fr[typeof exports]&&exports&&!exports.nodeType&&exports,$r=Fr[typeof module]&&module&&!module.nodeType&&module,Ir=Rr&&$r&&typeof global=="object"&&global; !Ir||Ir.global!==Ir&&Ir.window!==Ir&&Ir.self!==Ir||(Mr=Ir);var Dr=$r&&$r.exports===Rr&&Rr,Wr=Array.prototype,zr=Object.prototype,Cr=Mr._,Pr=Math.pow(2,53)-1,Ur=zr.toString,Vr=RegExp("^"+(null==Ur?"":(Ur+"").replace(_r,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gr=Math.ceil,Hr=Math.floor,Jr=Function.prototype.toString,Kr=zr.hasOwnProperty,Lr=Wr.push,Qr=zr.propertyIsEnumerable,Xr=Wr.splice,Yr=A(Yr=Object.create)&&Yr,Zr=A(Zr=Array.isArray)&&Zr,nt=Mr.isFinite,rt=Mr.isNaN,tt=A(tt=Object.keys)&&tt,et=Math.max,ut=Math.min,ot=A(ot=Date.now)&&ot,it=Math.random; i.prototype=o.prototype;var ft={};!function(){var n={0:1,length:1};ft.spliceObjects=(Xr.call(n,0,1),!n[0])}(0,0),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Yr||(c=function(){function n(){}return function(r){if(Z(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Mr.Object()}}());var at=S,ct=O,lt=j(function(n,r,t){Kr.call(n,t)?n[t]++:n[t]=1}),pt=j(function(n,r,t){Kr.call(n,t)?n[t].push(r):n[t]=[r]}),st=j(function(n,r,t){n[t]=r }),gt=j(function(n,r,t){n[t?0:1].push(r)},function(){return[[],[]]});X(arguments)||(X=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Kr.call(n,"callee")&&!Qr.call(n,"callee")||false});var ht=Zr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ur.call(n)==xr||false};Y(/x/)&&(Y=function(n){return typeof n=="function"&&"[object Function]"==Ur.call(n)});var vt=tt?function(n){return Z(n)?tt(n):[]}:E,yt=ot||function(){return(new Date).getTime()};o.after=function(n,r){if(!Y(r))throw new TypeError(vr); return n=nt(n=+n)?n:0,function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=G,o.bindAll=function(n){for(var r=1r?0:r)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=vt(n),e=t.length,u={};++ro?0:o>>>0);return g(n,function(n){var o=u?r:null!=n&&n[r];i[++e]=o?o.apply(n,t):lr}),i},o.keys=vt,o.map=D,o.matches=fr,o.max=W,o.memoize=function(n,r){if(!Y(n)||r&&!Y(r))throw new TypeError(vr);var t={};return function(){var e=r?r.apply(this,arguments):"_"+arguments[0];return Kr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null); -var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number"&&-1o?0:o>>>0);return g(n,function(n){var o=u?r:null!=n&&n[r];i[++e]=o?o.apply(n,t):lr}),i},o.keys=vt,o.map=D,o.matches=fr,o.max=W,o.memoize=function(n,r){if(!Y(n)||r&&!Y(r))throw new TypeError(vr);var t={};return function(){var e=r?r.apply(this,arguments):arguments[0];return"__proto__"==e?n.apply(this,arguments):Kr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r; +"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number"&&-1o?0:o>>>0);for(t=or(t,e,3),g(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c; return i},o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!Y(n))throw new TypeError(vr);return false===t?e=false:Z(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),H(n,r,{leading:e,maxWait:r,trailing:u})},o.times=function(n,r,t){n=0>n?0:n>>>0,r=l(r,t,1),t=-1;for(var e=Array(n);++tr?0:r);++n