From 39e123aaf4dbba862c2398baabf2919fa54eff0d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 18 May 2013 19:33:17 -0700 Subject: [PATCH] Rebuild files. Former-commit-id: ab61934d0b097036dc4cab968d92bfd1450fe8c7 --- dist/lodash.compat.js | 87 ++++++++++++++++++++++++++++++++--- dist/lodash.compat.min.js | 82 ++++++++++++++++----------------- dist/lodash.js | 75 +++++++++++++++++++++++++++--- dist/lodash.min.js | 74 ++++++++++++++--------------- dist/lodash.underscore.js | 31 +++++++++++-- dist/lodash.underscore.min.js | 58 +++++++++++------------ 6 files changed, 281 insertions(+), 126 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index ace453373..0b0c31e28 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -199,6 +199,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = context.isFinite, nativeIsNaN = context.isNaN, @@ -265,8 +266,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -352,6 +353,7 @@ * Detect if `name` or `message` properties of `Error.prototype` are * enumerable by default. (IE < 9, Safari < 5.1) * + * @memberOf _.support * @type Boolean */ support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); @@ -754,9 +756,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -820,6 +820,28 @@ ); } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + // fallback for browsers without `Object.create` + if (!nativeCreate) { + var createObject = function(prototype) { + if (isObject(prototype)) { + noop.prototype = prototype; + var result = new noop; + noop.prototype = null; + } + return result || {}; + }; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. @@ -2259,6 +2281,56 @@ return result; } + /** + * Transforms an `object` to an new `accumulator` object which is the result + * of running each of its elements through the `callback`, with each `callback` + * execution potentially mutating the `accumulator` object. The `callback`is + * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). + * Callbacks may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Objects + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {Mixed} [accumulator] The custom accumulator value. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Mixed} Returns the accumulated value. + * @example + * + * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { + * num *= num; + * if (num % 2) { + * return result.push(num) < 3; + * } + * }); + * // => [1, 9, 25] + * + * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + * result[key] = num * 3; + * }); + * // => { 'a': 3, 'b': 6, 'c': 9 } + */ + function transform(object, callback, accumulator, thisArg) { + var isArr = isArray(object); + callback = lodash.createCallback(callback, thisArg, 4); + + if (arguments.length < 3) { + if (isArr) { + accumulator = []; + } else { + var ctor = object && object.constructor, + proto = ctor && ctor.prototype; + + accumulator = createObject(proto); + } + } + (isArr ? each : forOwn)(object, function(value, index, object) { + return callback(accumulator, value, index, object); + }); + return accumulator; + } + /** * Creates an array composed of the own enumerable property values of `object`. * @@ -4528,7 +4600,7 @@ if (options === true) { var leading = true; trailing = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -4757,7 +4829,7 @@ } if (options === false) { leading = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -5365,6 +5437,7 @@ lodash.throttle = throttle; lodash.times = times; lodash.toArray = toArray; + lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 1940b48e3..0080d3f03 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,45 +4,45 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!xe(n)&&te.call(n,"__wrapped__")?n:new U(n)}function R(n){var t=n.length,e=t>=c;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; -r+="}"}return(t.b||we.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(be,A,Mt,te,Y,xe,ot,Oe,a,Gt,$,_e,P,Ut,oe)}function H(n){return"\\"+q[n]}function M(n){return Ae[n]}function G(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function Q(n){var t=!1;if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return t;var e=n.constructor;return(rt(e)?e instanceof e:we.nodeClass||!G(n))?we.ownLast?(Ne(n,function(n,e,r){return t=te.call(r,e),!1 -}),!0===t):(Ne(n,function(n,e){t=e}),!1===t||te.call(n,t)):t}function W(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Nt(0>e?0:e);++re?pe(0,u+e):e)||0,typeof u=="number"?a=-1<(ot(n)?n.indexOf(t,e):Ct(n,t,e)):Se(n,function(n){return++ru&&(u=i)}}else t=!t&&ot(n)?T:a.createCallback(t,e),Se(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) -});return u}function yt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),xe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var l=Oe(n),o=l.length;else we.unindexedChars&&ot(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),vt(n,function(n,r,a){r=l?l[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function mt(n,t,e){var r; -if(t=a.createCallback(t,e),xe(n)){e=-1;for(var u=n.length;++ee?pe(0,u+e):e||0)-1;else if(e)return r=kt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=c;if(p)var v={};for(null!=r&&(s=[],r=a.createCallback(r,u));++oCt(s,g))&&((r||p)&&s.push(g),f.push(u))}return f}function Et(n){for(var t=-1,e=n?ht($e(n,"length")):0,r=Nt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var Ce={a:"y,G,l",h:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},De=tt(Ae),Ie=J(Ce,{h:Ce.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=v.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"D[n]=d?d(D[n],s[n]):s[n]"}),Be=J(Ce),Ne=J(je,ke,{i:!1}),Pe=J(je,ke); -rt(/x/)&&(rt=function(n){return typeof n=="function"&&oe.call(n)==D});var Fe=ne?function(n){if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=ne(t))&&ne(e);return e?n==e||ne(n)==e:Q(n)}:Q,$e=gt;me&&u&&typeof ue=="function"&&(At=St(ue,r));var qe=8==ge(d+"08")?ge:function(n,t){return ge(ot(n)?n.replace(m,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ie,a.at=function(n){var t=-1,e=Yt.apply(Ht,ye.call(arguments,1)),r=e.length,u=Nt(r); -for(we.unindexedChars&&ot(n)&&(n=n.split(""));++t++l&&(a=n.apply(o,u)),i=ae(r,t),a}},a.defaults=Be,a.defer=At,a.delay=function(n,t){var r=ye.call(arguments,2);return ae(function(){n.apply(e,r)},t)},a.difference=bt,a.filter=st,a.flatten=wt,a.forEach=vt,a.forIn=Ne,a.forOwn=Pe,a.functions=nt,a.groupBy=function(n,t,e){var r={}; -return t=a.createCallback(t,e),vt(n,function(n,e,u){e=Lt(t(n,e,u)),(te.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return W(n,0,ve(pe(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=c,i=[],f=i;n:for(;++uCt(f,s)){o&&f.push(s); -for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(s))continue n;i.push(s)}}return i},a.invert=tt,a.invoke=function(n,t){var e=ye.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Nt(typeof a=="number"?a:0);return vt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=Oe,a.map=gt,a.max=ht,a.memoize=function(n,t){function e(){var r=e.cache,u=l+(t?t.apply(this,arguments):arguments[0]);return te.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},a.merge=it,a.min=function(n,t,e){var r=1/0,u=r; -if(!t&&xe(n)){e=-1;for(var o=n.length;++eCt(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=Oe(n),r=e.length,u=Nt(r);++te?pe(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=It,a.noConflict=function(){return r._=Vt,this},a.parseInt=qe,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},a.reduce=yt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e;return rt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:Oe(n).length},a.some=mt,a.sortedIndex=kt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=Be({},r,u);var o,i=Be({},r.imports,u.imports),u=Oe(i),i=lt(i),l=0,c=r.interpolate||b,v="__p+='",c=Kt((r.escape||b).source+"|"+c.source+"|"+(c===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(c,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(l,i).replace(w,H),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),l=i+t.length,t -}),v+="';\n",c=r=r.variable,c||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(s,"$1").replace(p,"$1;"),v="function("+r+"){"+(c?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=qt(u,"return "+v).apply(e,i)}catch(d){throw d.source=v,d}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Lt(n).replace(v,X)},a.uniqueId=function(n){var t=++o;return Lt(null==n?"":n)+t -},a.all=ft,a.any=mt,a.detect=pt,a.foldl=yt,a.foldr=dt,a.include=ct,a.inject=yt,Pe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ee.apply(t,arguments),n.apply(a,t)})}),a.first=_t,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return W(n,pe(0,u-r))}},a.take=_t,a.head=_t,Pe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return null==t||e&&typeof t!="function"?r:new U(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Lt(this.__wrapped__)},a.prototype.value=Bt,a.prototype.valueOf=Bt,Se(["join","pop","shift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Se(["push","reverse","sort","unshift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Se(["concat","slice","splice"],function(n){var t=Ht[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments)) -}}),we.spliceObjects||Se(["pop","shift","splice"],function(n){var t=Ht[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new U(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},l=+new Date+"",c=200,f=/\b__p\+='';/g,s=/\b(__p\+=)''\+/g,p=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,d=" \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",m=RegExp("^["+d+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",D="[object Function]",I="[object Number]",B="[object Object]",N="[object RegExp]",P="[object String]",F={}; +;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!Oe(n)&&ee.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; +r+="}"}return(t.b||je.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(we,A,Gt,ee,Z,Oe,it,Ae,a,Ut,$,Ce,P,Vt,ie)}function H(n){return at(n)?le(n):{}}function M(n){return"\\"+q[n]}function G(n){return Ie[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||ie.call(n)!=B||!je.argsClass&&Z(n))return t;var e=n.constructor;return(ut(e)?e instanceof e:je.nodeClass||!U(n))?je.ownLast?(Fe(n,function(n,e,r){return t=ee.call(r,e),!1 +}),!0===t):(Fe(n,function(n,e){t=e}),!1===t||ee.call(n,t)):t}function X(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Pt(0>e?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?a=-1<(it(n)?n.indexOf(t,e):jt(n,t,e)):De(n,function(n){return++ru&&(u=i)}}else t=!t&&it(n)?T:a.createCallback(t,e),De(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) +});return u}function mt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),Oe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var c=Ae(n),o=c.length;else je.unindexedChars&&it(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),gt(n,function(n,r,a){r=c?c[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function bt(n,t,e){var r; +if(t=a.createCallback(t,e),Oe(n)){e=-1;for(var u=n.length;++ee?ge(0,u+e):e||0)-1;else if(e)return r=xt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=l;if(p)var v={};for(null!=r&&(s=[],r=a.createCallback(r,u));++ojt(s,g))&&((r||p)&&s.push(g),f.push(u))}return f}function Ot(n){for(var t=-1,e=n?yt(ze(n,"length")):0,r=Pt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var ke={a:"y,G,l",h:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Be=et(Ie),Ne=J(ke,{h:ke.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=v.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"D[n]=d?d(D[n],s[n]):s[n]"}),Pe=J(ke),Fe=J(xe,Ee,{i:!1}),$e=J(xe,Ee); +ut(/x/)&&(ut=function(n){return typeof n=="function"&&ie.call(n)==D});var qe=te?function(n){if(!n||ie.call(n)!=B||!je.argsClass&&Z(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=te(t))&&te(e);return e?n==e||te(n)==e:W(n)}:W,ze=ht;_e&&u&&typeof ae=="function"&&(Dt=At(ae,r));var Re=8==ye(m+"08")?ye:function(n,t){return ye(it(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ne,a.at=function(n){var t=-1,e=Zt.apply(Mt,de.call(arguments,1)),r=e.length,u=Pt(r); +for(je.unindexedChars&&it(n)&&(n=n.split(""));++t++c&&(a=n.apply(o,u)),i=oe(r,t),a}},a.defaults=Pe,a.defer=Dt,a.delay=function(n,t){var r=de.call(arguments,2);return oe(function(){n.apply(e,r)},t)},a.difference=_t,a.filter=pt,a.flatten=Ct,a.forEach=gt,a.forIn=Fe,a.forOwn=$e,a.functions=tt,a.groupBy=function(n,t,e){var r={}; +return t=a.createCallback(t,e),gt(n,function(n,e,u){e=Jt(t(n,e,u)),(ee.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return X(n,0,he(ge(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],f=i;n:for(;++ujt(f,s)){o&&f.push(s); +for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(s))continue n;i.push(s)}}return i},a.invert=et,a.invoke=function(n,t){var e=de.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Pt(typeof a=="number"?a:0);return gt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=Ae,a.map=ht,a.max=yt,a.memoize=function(n,t){function e(){var r=e.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return ee.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},a.merge=ct,a.min=function(n,t,e){var r=1/0,u=r; +if(!t&&Oe(n)){e=-1;for(var o=n.length;++ejt(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=Ae(n),r=e.length,u=Pt(r);++targuments.length)if(u)e=[];else{var o=n&&n.constructor;e=H(o&&o.prototype)}return(u?De:$e)(n,function(n,r,u){return t(e,n,r,u)}),e},a.union=function(n){return Oe(n)||(arguments[0]=n?de.call(n):Mt),Et(Zt.apply(Mt,arguments))},a.uniq=Et,a.unzip=Ot,a.values=lt,a.where=pt,a.without=function(n){return _t(n,de.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];return re.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){return n?Ot(arguments):[]},a.zipObject=St,a.collect=ht,a.drop=kt,a.each=gt,a.extend=Ne,a.methods=tt,a.object=St,a.select=pt,a.tail=kt,a.unique=Et,Bt(a),a.chain=a,a.prototype.chain=function(){return this +},a.clone=nt,a.cloneDeep=function(n,t,e){return nt(n,!0,t,e)},a.contains=ft,a.escape=function(n){return null==n?"":Jt(n).replace(_,G)},a.every=st,a.find=vt,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++re?ge(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=Bt,a.noConflict=function(){return r._=Qt,this},a.parseInt=Re,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ne(e*(t-n+1))},a.reduce=mt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e; +return ut(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ae(n).length},a.some=bt,a.sortedIndex=xt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=Pe({},r,u);var o,i=Pe({},r.imports,u.imports),u=Ae(i),i=lt(i),c=0,l=r.interpolate||b,v="__p+='",l=Lt((r.escape||b).source+"|"+l.source+"|"+(l===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(c,i).replace(w,M),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),c=i+t.length,t +}),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(s,"$1").replace(p,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=zt(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(v,Y)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t +},a.all=st,a.any=bt,a.detect=vt,a.foldl=mt,a.foldr=dt,a.include=ft,a.inject=mt,$e(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return re.apply(t,arguments),n.apply(a,t)})}),a.first=wt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return X(n,ge(0,u-r))}},a.take=wt,a.head=wt,$e(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return null==t||e&&typeof t!="function"?r:new V(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Nt,a.prototype.valueOf=Nt,De(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),De(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),De(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) +}}),je.spliceObjects||De(["pop","shift","splice"],function(n){var t=Mt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new V(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=200,f=/\b__p\+='';/g,s=/\b(__p\+=)''\+/g,p=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=" \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",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",D="[object Function]",I="[object Number]",B="[object Object]",N="[object RegExp]",P="[object String]",F={}; F[D]=!1,F[x]=F[E]=F[O]=F[S]=F[I]=F[B]=F[N]=F[P]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):r&&!r.nodeType?u?(u.exports=z)._=z:r._=z:n._=z})(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 9622ebc00..cedd4486a 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -193,6 +193,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = context.isFinite, nativeIsNaN = context.isNaN, @@ -240,8 +241,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -487,9 +488,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -501,6 +500,17 @@ return bound; } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. @@ -1942,6 +1952,56 @@ return result; } + /** + * Transforms an `object` to an new `accumulator` object which is the result + * of running each of its elements through the `callback`, with each `callback` + * execution potentially mutating the `accumulator` object. The `callback`is + * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). + * Callbacks may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Objects + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {Mixed} [accumulator] The custom accumulator value. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Mixed} Returns the accumulated value. + * @example + * + * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { + * num *= num; + * if (num % 2) { + * return result.push(num) < 3; + * } + * }); + * // => [1, 9, 25] + * + * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + * result[key] = num * 3; + * }); + * // => { 'a': 3, 'b': 6, 'c': 9 } + */ + function transform(object, callback, accumulator, thisArg) { + var isArr = isArray(object); + callback = lodash.createCallback(callback, thisArg, 4); + + if (arguments.length < 3) { + if (isArr) { + accumulator = []; + } else { + var ctor = object && object.constructor, + proto = ctor && ctor.prototype; + + accumulator = createObject(proto); + } + } + (isArr ? each : forOwn)(object, function(value, index, object) { + return callback(accumulator, value, index, object); + }); + return accumulator; + } + /** * Creates an array composed of the own enumerable property values of `object`. * @@ -4218,7 +4278,7 @@ if (options === true) { var leading = true; trailing = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -4447,7 +4507,7 @@ } if (options === false) { leading = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -5055,6 +5115,7 @@ lodash.throttle = throttle; lodash.times = times; lodash.toArray = toArray; + lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 023c7a38b..ac344b22d 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,41 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:nt(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?we(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; -if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(lt(n)?n.indexOf(t,e):Et(n,t,e)):P(n,function(n){return++ru&&(u=o) -}}else t=!t&<(n)?J:G.createCallback(t,e),bt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function _t(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=we(n),u=i.length;return t=G.createCallback(t,r,4),bt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1; -for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iEt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function At(n){for(var t=-1,e=n?dt(_t(n,"length")):0,r=Dt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,we=ve?function(n){return ft(n)?ve(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=at(je);return Ut&&i&&typeof oe=="function"&&(Ft=Bt(oe,o)),zt=8==he(_+"08")?he:function(n,t){return he(lt(n)?n.replace(k,""):n,t||0) -},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=te.apply(Qt,me.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(i=n.apply(f,o)),c=ie(u,t),i}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=me.call(arguments,2); -return ie(function(){n.apply(e,r)},t)},G.difference=Ct,G.filter=yt,G.flatten=Ot,G.forEach=bt,G.forIn=K,G.forOwn=P,G.functions=ut,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),bt(n,function(n,e,u){e=Jt(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return tt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; -n:for(;++uEt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=at,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Dt(typeof a=="number"?a:0);return bt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=we,G.map=mt,G.max=dt,G.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); -return ue.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.merge=pt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eEt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e; -return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=we(n),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ee(e*(t-n+1)) -},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t -}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Mt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Jt(n).replace(h,et)},G.uniqueId=function(n){var t=++c;return Jt(n==u?"":n)+t -},G.all=gt,G.any=jt,G.detect=ht,G.foldl=kt,G.foldr=wt,G.include=vt,G.inject=kt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=xt,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return tt(n,ge(0,a-r))}},G.take=xt,G.head=xt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Jt(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,bt(["join","pop","shift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),bt(["push","reverse","sort","unshift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),bt(["concat","slice","splice"],function(n){var t=Qt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments)) -}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/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",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,j=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Error]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +;(function(n){function t(o){function f(n){if(!n||ie.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ee(t))&&ee(e);return e?n==e||ee(n)==e:Z(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?je(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; +if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(ct(n)?n.indexOf(t,e):Ot(n,t,e)):P(n,function(n){return++ru&&(u=o) +}}else t=!t&&ct(n)?J:G.createCallback(t,e),ht(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function dt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=qt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=je(n),u=i.length;return t=G.createCallback(t,r,4),ht(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=It(n,t),n[r]===t?r:-1; +for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iOt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function St(n){for(var t=-1,e=n?mt(dt(n,"length")):0,r=qt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,je=ve?function(n){return it(n)?ve(n):[]}:V,we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=ut(we);return Mt&&i&&typeof ae=="function"&&(Bt=$t(ae,o)),Dt=8==he(_+"08")?he:function(n,t){return he(ct(n)?n.replace(k,""):n,t||0) +},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,me.call(arguments,1)),r=e.length,u=qt(r);++t++l&&(i=n.apply(f,o)),c=oe(u,t),i}},G.defaults=M,G.defer=Bt,G.delay=function(n,t){var r=me.call(arguments,2); +return oe(function(){n.apply(e,r)},t)},G.difference=wt,G.filter=gt,G.flatten=xt,G.forEach=ht,G.forIn=K,G.forOwn=P,G.functions=rt,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),ht(n,function(n,e,u){e=Ht(t(n,e,u)),(re.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return nt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; +n:for(;++uOt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=ut,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=qt(typeof a=="number"?a:0);return ht(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=je,G.map=bt,G.max=mt,G.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); +return re.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.merge=lt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eOt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e; +return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=je(n),r=e.length,u=qt(r);++targuments.length)if(u)e=[];else{var a=n&&n.constructor;e=it(a&&a.prototype)?ce(a&&a.prototype):{}}return(u?each:P)(n,function(n,r,u){return t(e,n,r,u)}),e},G.union=function(n){return ke(n)||(arguments[0]=n?me.call(n):Lt),Nt(ne.apply(Lt,arguments))},G.uniq=Nt,G.unzip=St,G.values=pt,G.where=gt,G.without=function(n){return wt(n,me.call(arguments,1)) +},G.wrap=function(n,t){return function(){var e=[n];return ue.apply(e,arguments),t.apply(this,e)}},G.zip=function(n){return n?St(arguments):[]},G.zipObject=At,G.collect=bt,G.drop=Et,G.each=ht,G.extend=U,G.methods=rt,G.object=At,G.select=gt,G.tail=Et,G.unique=Nt,Rt(G),G.chain=G,G.prototype.chain=function(){return this},G.clone=et,G.cloneDeep=function(n,t,e){return et(n,r,t,e)},G.contains=st,G.escape=function(n){return n==u?"":Ht(n).replace(w,X)},G.every=vt,G.find=yt,G.findIndex=function(n,t,e){var r=-1,u=n?n.length:0; +for(t=G.createCallback(t,e);++re?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Rt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Dt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=_t,G.reduceRight=kt,G.result=function(n,t){var r=n?n[t]:e;return ot(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:je(n).length +},G.some=jt,G.sortedIndex=It,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=je(i),i=pt(i),f=0,c=u.interpolate||j,l="__p+='",c=Gt((u.escape||j).source+"|"+c.source+"|"+(c===d?b:j).source+"|"+(u.evaluate||j).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Ht(n).replace(h,tt)},G.uniqueId=function(n){var t=++c;return Ht(n==u?"":n)+t},G.all=vt,G.any=jt,G.detect=yt,G.foldl=_t,G.foldr=kt,G.include=st,G.inject=_t,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ue.apply(t,arguments),n.apply(G,t)})}),G.first=Ct,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; +for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return nt(n,ge(0,a-r))}},G.take=Ct,G.head=Ct,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Ht(this.__wrapped__)},G.prototype.value=Tt,G.prototype.valueOf=Tt,ht(["join","pop","shift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),ht(["push","reverse","sort","unshift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ht(["concat","slice","splice"],function(n){var t=Lt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/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",k=RegExp("^["+_+"]*0+(?=.$)"),j=/($^)/,w=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Error]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; T[A]=a,T[O]=T[E]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z})(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 92d7f107c..26cf100de 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -132,6 +132,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = window.isFinite, nativeIsNaN = window.isNaN, @@ -166,8 +167,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -382,9 +383,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -396,6 +395,28 @@ return bound; } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + // fallback for browsers without `Object.create` + if (!nativeCreate) { + var createObject = function(prototype) { + if (isObject(prototype)) { + noop.prototype = prototype; + var result = new noop; + noop.prototype = null; + } + return result || {}; + }; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index e0f71675c..f51d4be4b 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(n){return n instanceof t?n:new i(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function k(n,t,r){var e; -t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rT(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++or?Ot(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])T(a,f))&&(r&&a.push(f),i.push(e))}return i}function C(n,t){return kt.fastBind||jt&&2"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=Array.prototype,H=Object.prototype,pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Et=st.test(Et=Object.keys)&&Et,Ot=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),Ft=jt&&!/\n|true/.test(jt+H),kt={}; -(function(){var n={0:1,length:1};kt.fastBind=jt&&!Ft,kt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var qt=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Et?function(n){return m(n)?Et(n):[] -}:wt,Dt={"&":"&","<":"<",">":">",'"':""","'":"'"},Mt=v(Dt),Tt=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(t(n[r],r,n)===K)break;return n},$t=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(mt.call(n,r)&&t(n[r],r,n)===K)break;return n};y(/x/)&&(y=function(n){return typeof n=="function"&&"[object Function]"==dt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},t.bind=C,t.bindAll=function(n){for(var t=1T(o,i)){for(var a=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=O,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]); -return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),E(n,function(n,r,o){r=t(n,r,o),rT(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); -var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) -}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this -},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t -})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file +;(function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function B(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Mt(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; +t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Nt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; +(function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,l(arguments)||(l=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!ct[typeof n])return r; +for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=g,t.invoke=function(n,t){var r=kt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Mt,t.map=S,t.max=N,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) +}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Mt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=st,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Ft();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+mt(r*(t-n+1)) +},t.reduce=F,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Mt(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Y).source+"|"+(e.interpolate||Y).source+"|"+(e.evaluate||Y).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(nt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(c){throw c.source=i,c}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,c)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=F,t.foldr=k,t.include=w,t.inject=F,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return kt.call(n,Nt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=pt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Rt.spliceObjects&&0===n.length&&delete n[0],this +}}),E(["concat","join","slice"],function(n){var r=pt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t})(this); \ No newline at end of file