From aaaf452fdccb35c6d506b143fc2f943f92e43a6a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 15 Dec 2013 01:19:25 -0800 Subject: [PATCH] Move "escape" and "evaluate" delimiters to their own regexes. Cleanup the `_` docs and `iteratorTemplate`. --- dist/lodash.compat.js | 58 +++---- dist/lodash.compat.min.js | 108 ++++++------ dist/lodash.js | 65 ++++---- dist/lodash.min.js | 98 +++++------ dist/lodash.underscore.js | 67 ++++---- dist/lodash.underscore.min.js | 2 +- doc/README.md | 298 +++++++++++++++++----------------- lodash.js | 62 +++---- 8 files changed, 390 insertions(+), 368 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 7c1ccd6f9..e97c6ce50 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -60,8 +60,10 @@ /** Used to detected named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match leading whitespace and zeros to be removed */ var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); @@ -581,16 +583,16 @@ * * The chainable wrapper functions are: * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` + * `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, + * `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, + * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `map`, `mapValues`, `max`, `memoize`, `merge`, + * `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, + * `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, + * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, @@ -598,12 +600,12 @@ * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` + * `lastIndexOf`, `mixin`, `noConflict`, `now`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, + * `runInContext`, `template`, `unescape`, `uniqueId`, and `value` * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. + * The wrapper functions `first`, `last`, and `sample` return wrapped values + * when `n` is provided, otherwise they return unwrapped values. * * Explicit chaining can be enabled by using the `_.chain` method. * @@ -821,7 +823,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'escape': /<%-([\s\S]+?)%>/g, + 'escape': reEscape, /** * Used to detect code to be evaluated. @@ -829,7 +831,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'evaluate': /<%([\s\S]+?)%>/g, + 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. @@ -878,13 +880,13 @@ var __p = 'var result = ' + (obj.init) + - ';\nif (!(object && objectTypes[typeof object])) return result;\n' + + ';\nif (!(object && objectTypes[typeof object])) {\n return result;\n}\n' + (obj.top) + ';'; if (support.nonEnumArgs) { __p += '\nvar length = object.length;\nif (length && isArguments(object)) {\n key = -1;\n while (++key < length) {\n key += \'\';\n ' + (obj.loop) + - ';\n }\n return result\n}'; + ';\n }\n return result;\n}'; } if (support.enumPrototypes) { @@ -901,7 +903,7 @@ __p += '\nfor (var key in object) {\n'; if (obj.useHas) { conditions.push('hasOwnProperty.call(object, key)'); } if (conditions.length) { - __p += ' if (' + + __p += ' if (' + (conditions.join(' && ')) + ') {\n '; } @@ -909,11 +911,11 @@ (obj.loop) + '; '; if (conditions.length) { - __p += '\n }'; + __p += '\n }'; } __p += '\n}\n'; if (support.nonEnumShadows) { - __p += '\nif (object !== objectProto) {\n var ctor = object.constructor,\n isProto = object === (ctor && ctor.prototype),\n className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),\n nonEnum = nonEnumProps[className];\n '; + __p += '\nif (object !== objectProto) {\n var ctor = object.constructor,\n isProto = object === (ctor && ctor.prototype),\n className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),\n nonEnum = nonEnumProps[className];\n '; for (var index = 0; index < 7; index++) { __p += '\n key = \'' + (obj.shadowedProps[index]) + @@ -923,11 +925,11 @@ } __p += ') {\n ' + (obj.loop) + - ';\n } '; + ';\n } '; } __p += '\n}'; } - __p += '\nreturn result'; + __p += '\nreturn result;'; return __p }; @@ -1912,7 +1914,7 @@ var shimKeys = createIterator({ 'args': 'object', 'init': '[]', - 'top': 'if (!(objectTypes[typeof object])) return result', + 'top': '', 'loop': 'result.push(key)', 'useHas': true }); @@ -2337,7 +2339,7 @@ 'args': 'object, callback, thisArg', 'init': 'object', 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)", - 'loop': 'if (callback(object[key], key, object) === false) return result', + 'loop': 'if (callback(object[key], key, object) === false) {\n return result;\n }', 'useHas': false }); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 013b4c98f..7a723dde8 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,58 +4,58 @@ * Build: `lodash -o ./dist/lodash.compat.js` */ ;(function(){function n(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++ri||typeof a=="undefined")return 1;if(ai||typeof a=="undefined")return 1;if(ar?0:r);++e=b&&a===n,l=[];if(f){var c=o(e);c?(a=t,e=c):f=false}for(;++ua(e,c)&&l.push(c);return f&&p(e),l}function rt(n,t,r){var e=-1,u=n,o=n?n.length:0; -if(t=t&&typeof r=="undefined"?t:Y(t,r,3),typeof o=="number")for(zr.unindexedChars&&Et(u)&&(u=u.split(""));++e=b&&f===n,h=u||g?i():s;for(g&&(h=o(h),f=t);++af(h,y))&&((u||g)&&h.push(y),s.push(v)) -}return g?(c(h.g),p(h)):u&&c(h),s}function ft(n){return function(t,r,e){var u={};if(r=v.createCallback(r,e,3),Mr(t)){e=-1;for(var o=t.length;++eu;u++)e+="l='"+n.d[u]+"';if((!(k&&n[l])&&h.call(p,l))",n.f||(e+="||(!n[l]&&p[l]!==q[l])"),e+="){"+n.c+"}"; -e+="}"}return t("a,f,g,h,j,q,r,o,v,w,y",r+(e+"return s")+"}")(Y,B,sr,Cr,yt,gr,H,Wr,M,hr,mr)}function pt(n){return Gr[n]}function st(){var t=(t=v.indexOf)===zt?n:t;return t}function gt(n){return typeof n=="function"&&dr.test(jr.call(n))}function ht(n){var t,r;return!n||mr.call(n)!=z||(t=n.constructor,Ct(t)&&!(t instanceof t))||!zr.argsClass&&yt(n)||!zr.nodeClass&&l(n)?false:zr.ownLast?(Xr(n,function(n,t,e){return r=Cr.call(e,t),false}),false!==r):(Xr(n,function(n,t){r=t}),typeof r=="undefined"||Cr.call(n,r)) -}function vt(n){return Hr[n]}function yt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&mr.call(n)==D||false}function mt(n,t,r){var e=arguments,u=0,o=typeof r=="number"?2:e.length;if(3r?$r(0,o+r):r)||0,Mr(n)?a=-1o&&(o=i)}}else t=null==t&&Et(n)?e:v.createCallback(t,r,3),rt(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n) -});return o}function Ft(n,t,r,e){var u=3>arguments.length;if(t=v.createCallback(t,e,4),Mr(n)){var o=-1,a=n.length;for(u&&(r=n[++o]);++oarguments.length;return t=v.createCallback(t,e,4),Tt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Bt(n){var t=-1,r=n?n.length:0,e=tr(typeof r=="number"?r:0);return Pt(n,function(n){var r=at(0,++t);e[t]=e[r],e[r]=n}),e}function Lt(n,t,r){var e;if(t=v.createCallback(t,r,3),Mr(n)){r=-1; -for(var u=n.length;++re?$r(0,u+e):e||0}else if(e)return e=Mt(t,r),t[e]===r?e:-1;return n(t,r,e)}function Kt(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0; -for(t=v.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++t=h;m?(u&&(u=_r(u)),c=a,o=n.apply(i,e)):u||(u=Er(y,h))}return m&&f?f=_r(f):f||t===p||(f=Er(v,t)),r&&(m=true,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function Qt(n){return n}function Xt(n,t,r){var e=true,u=t&&wt(t);t&&(r||u.length)||(null==r&&(r=t),o=y,t=n,n=v,u=wt(t)),false===r?e=false:kt(r)&&"chain"in r&&(e=r.chain); -var o=n,a=Ct(o);Pt(u,function(r){var u=n[r]=t[r];a&&(o.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,a=[r];if(kr.apply(a,arguments),a=u.apply(n,a),e||t){if(r===a&&kt(a))return this;a=new o(a),a.__chain__=t}return a})})}function Yt(){}function Zt(n){return function(t){return t[n]}}function nr(){return this.__wrapped__}r=r?tt.defaults(Q.Object(),r,tt.pick(Q,P)):Q;var tr=r.Array,rr=r.Boolean,er=r.Date,ur=r.Function,or=r.Math,ar=r.Number,ir=r.Object,fr=r.RegExp,lr=r.String,cr=r.TypeError,pr=[],sr=r.Error.prototype,gr=ir.prototype,hr=lr.prototype,vr=(vr=r.window)&&vr.document,yr=r._,mr=gr.toString,dr=fr("^"+lr(mr).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),br=or.ceil,_r=r.clearTimeout,wr=or.floor,jr=ur.prototype.toString,xr=gt(xr=ir.getPrototypeOf)&&xr,Cr=gr.hasOwnProperty,kr=pr.push,Or=gr.propertyIsEnumerable,Er=r.setTimeout,Sr=pr.splice,Ir=pr.unshift,Ar=function(){try{var n={},t=gt(t=ir.defineProperty)&&t,r=t(n,n,n)&&t -}catch(e){}return r}(),Nr=gt(Nr=ir.create)&&Nr,Rr=gt(Rr=tr.isArray)&&Rr,Pr=r.isFinite,Tr=r.isNaN,Dr=gt(Dr=ir.keys)&&Dr,$r=or.max,Fr=or.min,qr=r.parseInt,Br=or.random,Lr={};Lr[$]=tr,Lr[F]=rr,Lr[q]=er,Lr[L]=ur,Lr[z]=ir,Lr[W]=ar,Lr[K]=fr,Lr[M]=lr;var Wr={};Wr[$]=Wr[q]=Wr[W]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Wr[F]=Wr[M]={constructor:true,toString:true,valueOf:true},Wr[B]=Wr[L]=Wr[K]={constructor:true,toString:true},Wr[z]={constructor:true},function(){for(var n=T.length;n--;){var t,r=T[n]; -for(t in Wr)Cr.call(Wr,t)&&!Cr.call(Wr[t],r)&&(Wr[t][r]=false)}}(),y.prototype=v.prototype;var zr=v.support={};!function(){var n=function(){this.x=1},t={0:1,length:1},e=[];n.prototype={valueOf:1,y:1};for(var u in new n)e.push(u);for(u in arguments);zr.argsClass=mr.call(arguments)==D,zr.argsObject=arguments.constructor==ir&&!(arguments instanceof tr),zr.dom=!!vr&&typeof vr=="object"&&dr.test(_r)&&dr.test(Er),zr.enumErrorProps=Or.call(sr,"message")||Or.call(sr,"name"),zr.enumPrototypes=Or.call(n,"prototype"),zr.funcDecomp=!gt(r.WinRTError)&&N.test(g),zr.funcNames=typeof ur.name=="string",zr.nonEnumArgs=0!=u,zr.nonEnumShadows=!/valueOf/.test(e),zr.ownLast="x"!=e[0],zr.spliceObjects=(pr.splice.call(t,0,1),!t[0]),zr.unindexedChars="xx"!="x"[0]+ir("x")[0]; -try{zr.nodeClass=!(mr.call(undefined)==z&&!({toString:0}+""))}catch(o){zr.nodeClass=true}}(1),v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:S,variable:"",imports:{_:v}},Nr||(X=function(){function n(){}return function(t){if(kt(t)){n.prototype=t;var e=new n;n.prototype=null}return e||r.Object()}}());var Kr=Ar?function(n,t){G.value=t,Ar(n,"__bindData__",G)}:Yt;zr.argsClass||(yt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Cr.call(n,"callee")&&!Or.call(n,"callee")||false});var Mr=Rr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&mr.call(n)==$||false -},Vr=ct({a:"p",b:"[]",e:"if(!(r[typeof p]))return s",c:"s.push(l)",f:true}),Ur=Dr?function(n){return kt(n)?zr.enumPrototypes&&typeof n=="function"||zr.nonEnumArgs&&n.length&&yt(n)?Vr(n):Dr(n):[]}:Vr,Gr={"&":"&","<":"<",">":">",'"':""","'":"'"},Hr=jt(Gr),Jr=fr("("+Ur(Hr).join("|")+")","g"),Qr=fr("["+Ur(Gr).join("")+"]","g"),Xr=ct({a:"p,b,x",b:"p",e:"b=b&&typeof x=='undefined'?b:a(b,x,3)",c:"if(b(p[l],l,p)===false)return s",f:false});zr.dom||(xt=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!Yr(n)||false -}),Ct(/x/)&&(Ct=function(n){return typeof n=="function"&&mr.call(n)==L});var Yr=xr?function(n){if(!n||mr.call(n)!=z||!zr.argsClass&&yt(n))return false;var t=n.valueOf,r=gt(t)&&(r=xr(t))&&xr(r);return r?n==r||xr(n)==r:ht(n)}:ht,Zr=ft(function(n,t,r){Cr.call(n,r)?n[r]++:n[r]=1}),ne=ft(function(n,t,r){(Cr.call(n,r)?n[r]:n[r]=[]).push(t)}),te=ft(function(n,t,r){n[r]=t}),re=Dt,ee=gt(ee=er.now)&&ee||function(){return(new er).getTime()},ue=8==qr(w+"08")?qr:function(n,t){return qr(Et(n)?n.replace(I,""):n,t||0) -};return v.after=function(n,t){if(!Ct(t))throw new cr;return function(){return 1>--n?t.apply(this,arguments):void 0}},v.assign=mt,v.at=function(n){var t=arguments,r=-1,e=et(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=tr(t);for(zr.unindexedChars&&Et(n)&&(n=n.split(""));++r=b&&o(e?r[e]:s)))}var l=r[0],h=-1,v=l?l.length:0,y=[];n:for(;++h(m?t(m,g):f(s,g))){for(e=u,(m||s).push(g);--e;)if(m=a[e],0>(m?t(m,g):f(r[e],g)))continue n;y.push(g) -}}for(;u--;)(m=a[u])&&p(m);return c(a),c(s),y},v.invert=jt,v.invoke=function(n,t){var r=s(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,a=tr(typeof o=="number"?o:0);return Pt(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},v.keys=Ur,v.map=Dt,v.mapValues=function(n,t,r){var e={};return t=v.createCallback(t,r,3),bt(n,function(n,r,u){e[r]=t(n,r,u)}),e},v.max=$t,v.memoize=function(n,t){if(!Ct(n))throw new cr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):d+arguments[0];return Cr.call(e,u)?e[u]:e[u]=n.apply(this,arguments) -};return r.cache={},r},v.merge=function(n){var t=arguments,r=2;if(!kt(n))return n;if("number"!=typeof t[2]&&(r=t.length),3r?$r(0,e+r):Fr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},v.mixin=Xt,v.noConflict=function(){return r._=yr,this},v.noop=Yt,v.now=ee,v.parseInt=ue,v.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(typeof n=="boolean"&&u?(r=n,n=1):u||typeof t!="boolean"||(r=t,u=true)),e&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Br(),Fr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):at(n,t) -},v.reduce=Ft,v.reduceRight=qt,v.result=function(n,t){if(n){var r=n[t];return Ct(r)?n[t]():r}},v.runInContext=g,v.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ur(n).length},v.some=Lt,v.sortedIndex=Mt,v.template=function(n,t,r){var e=v.templateSettings;n=lr(n||""),r=dt({},r,e);var u,o=dt({},r.imports,e.imports),e=Ur(o),o=St(o),i=0,f=r.interpolate||A,l="__p+='",f=fr((r.escape||A).source+"|"+f.source+"|"+(f===S?k:A).source+"|"+(r.evaluate||A).source+"|$","g");n.replace(f,function(t,r,e,o,f,c){return e||(e=o),l+=n.slice(i,c).replace(R,a),r&&(l+="'+__e("+r+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t -}),l+="';",f=r=r.variable,f||(r="obj",l="with("+r+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(x,"$1").replace(C,"$1;"),l="function("+r+"){"+(f?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=ur(e,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},v.unescape=function(n){return null==n?"":(n=lr(n),0>n.indexOf(";")?n:n.replace(Jr,vt))},v.uniqueId=function(n){var t=++m; -return lr(null==n?"":n)+t},v.all=At,v.any=Lt,v.detect=Rt,v.findWhere=Rt,v.foldl=Ft,v.foldr=qt,v.include=It,v.inject=Ft,Xt(function(){var n={};return bt(v,function(t,r){v.prototype[r]||(n[r]=t)}),n}(),false),v.first=Wt,v.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:h;return s(n,$r(0,u-e))},v.sample=function(n,t,r){return n&&typeof n.length!="number"?n=St(n):zr.unindexedChars&&Et(n)&&(n=n.split("")),null==t||r?n?n[at(0,n.length-1)]:h:(n=Bt(n),n.length=Fr($r(0,t),n.length),n) -},v.take=Wt,v.head=Wt,bt(v,function(n,t){var r="sample"!==t;v.prototype[t]||(v.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new y(o,u):o})}),v.VERSION="2.4.1",v.prototype.chain=function(){return this.__chain__=true,this},v.prototype.toString=function(){return lr(this.__wrapped__)},v.prototype.value=nr,v.prototype.valueOf=nr,rt(["join","pop","shift"],function(n){var t=pr[n];v.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); -return n?new y(r,n):r}}),rt(["push","reverse","sort","unshift"],function(n){var t=pr[n];v.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),rt(["concat","slice","splice"],function(n){var t=pr[n];v.prototype[n]=function(){return new y(t.apply(this.__wrapped__,arguments),this.__chain__)}}),zr.spliceObjects||rt(["pop","shift","splice"],function(n){var t=pr[n],r="splice"==n;v.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new y(u,n):u -}}),v}var h,v=[],y=[],m=0,d=+new Date+"",b=75,_=40,w=" \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",j=/\b__p\+='';/g,x=/\b(__p\+=)''\+/g,C=/(__e\(.*?\)|\b__t\))\+'';/g,k=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,E=/^\s*function[ \n\r\t]+\w/,S=/<%=([\s\S]+?)%>/g,I=RegExp("^["+w+"]*0+(?=.$)"),A=/($^)/,N=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,P="Array Boolean Date Error Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),T="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),D="[object Arguments]",$="[object Array]",F="[object Boolean]",q="[object Date]",B="[object Error]",L="[object Function]",W="[object Number]",z="[object Object]",K="[object RegExp]",M="[object String]",V={}; -V[L]=false,V[D]=V[$]=V[F]=V[q]=V[W]=V[z]=V[K]=V[M]=true;var U={leading:false,maxWait:0,trailing:false},G={configurable:false,enumerable:false,value:null,writable:false},H={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},J={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Q=H[typeof window]&&window||this,X=H[typeof exports]&&exports&&!exports.nodeType&&exports,Y=H[typeof module]&&module&&!module.nodeType&&module,Z=Y&&Y.exports===X&&X,nt=H[typeof global]&&global;!nt||nt.global!==nt&&nt.window!==nt||(Q=nt); -var tt=g();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Q._=tt, define(function(){return tt})):X&&Y?Z?(Y.exports=tt)._=tt:X._=tt:Q._=tt}).call(this); \ No newline at end of file +return u}function g(r){function v(n){return n&&typeof n=="object"&&!Ur(n)&&Or.call(n,"__wrapped__")?n:new y(n)}function y(n,t){this.__chain__=!!t,this.__wrapped__=n}function _(n){function t(){if(e){var n=s(e);Er.apply(n,arguments)}if(this instanceof t){var o=Z(r.prototype),n=r.apply(o,n||arguments);return Et(n)?n:o}return r.apply(u,n||arguments)}var r=n[0],e=n[2],u=n[4];return Vr(t,n),t}function X(n,t,r,e,u){if(r){var o=r(n);if(typeof o!="undefined")return o}if(!Et(n))return n;var a=br.call(n);if(!G[a]||!Mr.nodeClass&&l(n))return n; +var f=zr[a];switch(a){case B:case L:return new f(+n);case K:case U:return new f(n);case V:return o=f(n.source,O.exec(n)),o.lastIndex=n.lastIndex,o}if(a=Ur(n),t){var p=!e;e||(e=i()),u||(u=i());for(var g=e.length;g--;)if(e[g]==n)return u[g];o=a?f(n.length):{}}else o=a?s(n):bt({},n);return a&&(Or.call(n,"index")&&(o.index=n.index),Or.call(n,"input")&&(o.input=n.input)),t?(e.push(n),u.push(o),(a?ut:wt)(n,function(n,a){o[a]=X(n,t,r,e,u)}),p&&(c(e),c(u)),o):o}function Z(n){return Et(n)?Pr(n):{}}function nt(n,t,r){if(typeof n!="function")return Yt; +if(typeof t=="undefined"||!("prototype"in n))return n;var e=n.__bindData__;if(typeof e=="undefined"&&(Mr.funcNames&&(e=!n.name),e=e||!Mr.funcDecomp,!e)){var u=Cr.call(n);Mr.funcNames||(e=!E.test(u)),e||(e=P.test(u),Vr(n,e))}if(false===e||true!==e&&1&e[1])return n;switch(r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,o){return n.call(t,r,e,u,o)}}return Qt(n,t)}function tt(n){function t(){var n=f?a:this; +if(u){var h=s(u);Er.apply(h,arguments)}return(o||c)&&(h||(h=s(arguments)),o&&Er.apply(h,o),c&&h.length=b&&a===n,l=[];if(f){var c=o(e);c?(a=t,e=c):f=false}for(;++ua(e,c)&&l.push(c);return f&&p(e),l}function ut(n,t,r){var e=-1,u=n,o=n?n.length:0; +if(t=t&&typeof r=="undefined"?t:nt(t,r,3),typeof o=="number")for(Mr.unindexedChars&&It(u)&&(u=u.split(""));++e=b&&f===n,h=u||g?i():s;for(g&&(h=o(h),f=t);++af(h,y))&&((u||g)&&h.push(y),s.push(v)) +}return g?(c(h.g),p(h)):u&&c(h),s}function ct(n){return function(t,r,e){var u={};if(r=v.createCallback(r,e,3),Ur(t)){e=-1;for(var o=t.length;++eu;u++)e+="l='"+n.d[u]+"';if((!(k&&n[l])&&h.call(p,l))",n.f||(e+="||(!n[l]&&p[l]!==q[l])"),e+="){"+n.c+"}"; +e+="}"}return t("a,f,g,h,j,q,r,o,v,w,y",r+(e+"return s;")+"}")(nt,W,hr,Or,dt,vr,Q,Kr,U,yr,br)}function gt(n){return Jr[n]}function ht(){var t=(t=v.indexOf)===Mt?n:t;return t}function vt(n){return typeof n=="function"&&_r.test(Cr.call(n))}function yt(n){var t,r;return!n||br.call(n)!=M||(t=n.constructor,Ot(t)&&!(t instanceof t))||!Mr.argsClass&&dt(n)||!Mr.nodeClass&&l(n)?false:Mr.ownLast?(Zr(n,function(n,t,e){return r=Or.call(e,t),false}),false!==r):(Zr(n,function(n,t){r=t}),typeof r=="undefined"||Or.call(n,r)) +}function mt(n){return Qr[n]}function dt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&br.call(n)==F||false}function bt(n,t,r){var e=arguments,u=0,o=typeof r=="number"?2:e.length;if(3r?qr(0,o+r):r)||0,Ur(n)?a=-1o&&(o=i)}}else t=null==t&&It(n)?e:v.createCallback(t,r,3),ut(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n) +});return o}function Bt(n,t,r,e){var u=3>arguments.length;if(t=v.createCallback(t,e,4),Ur(n)){var o=-1,a=n.length;for(u&&(r=n[++o]);++oarguments.length;return t=v.createCallback(t,e,4),$t(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Wt(n){var t=-1,r=n?n.length:0,e=er(typeof r=="number"?r:0);return Dt(n,function(n){var r=ft(0,++t);e[t]=e[r],e[r]=n}),e}function zt(n,t,r){var e;if(t=v.createCallback(t,r,3),Ur(n)){r=-1; +for(var u=n.length;++re?qr(0,u+e):e||0}else if(e)return e=Ut(t,r),t[e]===r?e:-1;return n(t,r,e)}function Vt(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0; +for(t=v.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++t=h;m?(u&&(u=jr(u)),c=a,o=n.apply(i,e)):u||(u=Ir(y,h))}return m&&f?f=jr(f):f||t===p||(f=Ir(v,t)),r&&(m=true,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function Yt(n){return n}function Zt(n,t,r){var e=true,u=t&&xt(t);t&&(r||u.length)||(null==r&&(r=t),o=y,t=n,n=v,u=xt(t)),false===r?e=false:Et(r)&&"chain"in r&&(e=r.chain); +var o=n,a=Ot(o);Dt(u,function(r){var u=n[r]=t[r];a&&(o.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,a=[r];if(Er.apply(a,arguments),a=u.apply(n,a),e||t){if(r===a&&Et(a))return this;a=new o(a),a.__chain__=t}return a})})}function nr(){}function tr(n){return function(t){return t[n]}}function rr(){return this.__wrapped__}r=r?et.defaults(Y.Object(),r,et.pick(Y,D)):Y;var er=r.Array,ur=r.Boolean,or=r.Date,ar=r.Function,ir=r.Math,fr=r.Number,lr=r.Object,cr=r.RegExp,pr=r.String,sr=r.TypeError,gr=[],hr=r.Error.prototype,vr=lr.prototype,yr=pr.prototype,mr=(mr=r.window)&&mr.document,dr=r._,br=vr.toString,_r=cr("^"+pr(br).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),wr=ir.ceil,jr=r.clearTimeout,xr=ir.floor,Cr=ar.prototype.toString,kr=vt(kr=lr.getPrototypeOf)&&kr,Or=vr.hasOwnProperty,Er=gr.push,Sr=vr.propertyIsEnumerable,Ir=r.setTimeout,Ar=gr.splice,Nr=gr.unshift,Rr=function(){try{var n={},t=vt(t=lr.defineProperty)&&t,r=t(n,n,n)&&t +}catch(e){}return r}(),Pr=vt(Pr=lr.create)&&Pr,Tr=vt(Tr=er.isArray)&&Tr,Dr=r.isFinite,$r=r.isNaN,Fr=vt(Fr=lr.keys)&&Fr,qr=ir.max,Br=ir.min,Lr=r.parseInt,Wr=ir.random,zr={};zr[q]=er,zr[B]=ur,zr[L]=or,zr[z]=ar,zr[M]=lr,zr[K]=fr,zr[V]=cr,zr[U]=pr;var Kr={};Kr[q]=Kr[L]=Kr[K]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Kr[B]=Kr[U]={constructor:true,toString:true,valueOf:true},Kr[W]=Kr[z]=Kr[V]={constructor:true,toString:true},Kr[M]={constructor:true},function(){for(var n=$.length;n--;){var t,r=$[n]; +for(t in Kr)Or.call(Kr,t)&&!Or.call(Kr[t],r)&&(Kr[t][r]=false)}}(),y.prototype=v.prototype;var Mr=v.support={};!function(){var n=function(){this.x=1},t={0:1,length:1},e=[];n.prototype={valueOf:1,y:1};for(var u in new n)e.push(u);for(u in arguments);Mr.argsClass=br.call(arguments)==F,Mr.argsObject=arguments.constructor==lr&&!(arguments instanceof er),Mr.dom=!!mr&&typeof mr=="object"&&_r.test(jr)&&_r.test(Ir),Mr.enumErrorProps=Sr.call(hr,"message")||Sr.call(hr,"name"),Mr.enumPrototypes=Sr.call(n,"prototype"),Mr.funcDecomp=!vt(r.WinRTError)&&P.test(g),Mr.funcNames=typeof ar.name=="string",Mr.nonEnumArgs=0!=u,Mr.nonEnumShadows=!/valueOf/.test(e),Mr.ownLast="x"!=e[0],Mr.spliceObjects=(gr.splice.call(t,0,1),!t[0]),Mr.unindexedChars="xx"!="x"[0]+lr("x")[0]; +try{Mr.nodeClass=!(br.call(undefined)==M&&!({toString:0}+""))}catch(o){Mr.nodeClass=true}}(1),v.templateSettings={escape:S,evaluate:I,interpolate:A,variable:"",imports:{_:v}},Pr||(Z=function(){function n(){}return function(t){if(Et(t)){n.prototype=t;var e=new n;n.prototype=null}return e||r.Object()}}());var Vr=Rr?function(n,t){J.value=t,Rr(n,"__bindData__",J)}:nr;Mr.argsClass||(dt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n,"callee")&&!Sr.call(n,"callee")||false});var Ur=Tr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&br.call(n)==q||false +},Gr=st({a:"p",b:"[]",e:"",c:"s.push(l)",f:true}),Hr=Fr?function(n){return Et(n)?Mr.enumPrototypes&&typeof n=="function"||Mr.nonEnumArgs&&n.length&&dt(n)?Gr(n):Fr(n):[]}:Gr,Jr={"&":"&","<":"<",">":">",'"':""","'":"'"},Qr=Ct(Jr),Xr=cr("("+Hr(Qr).join("|")+")","g"),Yr=cr("["+Hr(Jr).join("")+"]","g"),Zr=st({a:"p,b,x",b:"p",e:"b=b&&typeof x=='undefined'?b:a(b,x,3)",c:"if(b(p[l],l,p)===false){return s}",f:false});Mr.dom||(kt=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!ne(n)||false +}),Ot(/x/)&&(Ot=function(n){return typeof n=="function"&&br.call(n)==z});var ne=kr?function(n){if(!n||br.call(n)!=M||!Mr.argsClass&&dt(n))return false;var t=n.valueOf,r=vt(t)&&(r=kr(t))&&kr(r);return r?n==r||kr(n)==r:yt(n)}:yt,te=ct(function(n,t,r){Or.call(n,r)?n[r]++:n[r]=1}),re=ct(function(n,t,r){(Or.call(n,r)?n[r]:n[r]=[]).push(t)}),ee=ct(function(n,t,r){n[r]=t}),ue=Ft,oe=vt(oe=or.now)&&oe||function(){return(new or).getTime()},ae=8==Lr(w+"08")?Lr:function(n,t){return Lr(It(n)?n.replace(N,""):n,t||0) +};return v.after=function(n,t){if(!Ot(t))throw new sr;return function(){return 1>--n?t.apply(this,arguments):void 0}},v.assign=bt,v.at=function(n){var t=arguments,r=-1,e=ot(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=er(t);for(Mr.unindexedChars&&It(n)&&(n=n.split(""));++r=b&&o(e?r[e]:s)))}var l=r[0],h=-1,v=l?l.length:0,y=[];n:for(;++h(m?t(m,g):f(s,g))){for(e=u,(m||s).push(g);--e;)if(m=a[e],0>(m?t(m,g):f(r[e],g)))continue n;y.push(g) +}}for(;u--;)(m=a[u])&&p(m);return c(a),c(s),y},v.invert=Ct,v.invoke=function(n,t){var r=s(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,a=er(typeof o=="number"?o:0);return Dt(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},v.keys=Hr,v.map=Ft,v.mapValues=function(n,t,r){var e={};return t=v.createCallback(t,r,3),wt(n,function(n,r,u){e[r]=t(n,r,u)}),e},v.max=qt,v.memoize=function(n,t){if(!Ot(n))throw new sr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):d+arguments[0];return Or.call(e,u)?e[u]:e[u]=n.apply(this,arguments) +};return r.cache={},r},v.merge=function(n){var t=arguments,r=2;if(!Et(n))return n;if("number"!=typeof t[2]&&(r=t.length),3r?qr(0,e+r):Br(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},v.mixin=Zt,v.noConflict=function(){return r._=dr,this},v.noop=nr,v.now=oe,v.parseInt=ae,v.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(typeof n=="boolean"&&u?(r=n,n=1):u||typeof t!="boolean"||(r=t,u=true)),e&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Wr(),Br(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):ft(n,t) +},v.reduce=Bt,v.reduceRight=Lt,v.result=function(n,t){if(n){var r=n[t];return Ot(r)?n[t]():r}},v.runInContext=g,v.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Hr(n).length},v.some=zt,v.sortedIndex=Ut,v.template=function(n,t,r){var e=v.templateSettings;n=pr(n||""),r=_t({},r,e);var u,o=_t({},r.imports,e.imports),e=Hr(o),o=At(o),i=0,f=r.interpolate||R,l="__p+='",f=cr((r.escape||R).source+"|"+f.source+"|"+(f===A?k:R).source+"|"+(r.evaluate||R).source+"|$","g");n.replace(f,function(t,r,e,o,f,c){return e||(e=o),l+=n.slice(i,c).replace(T,a),r&&(l+="'+__e("+r+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t +}),l+="';",f=r=r.variable,f||(r="obj",l="with("+r+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(x,"$1").replace(C,"$1;"),l="function("+r+"){"+(f?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=ar(e,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},v.unescape=function(n){return null==n?"":(n=pr(n),0>n.indexOf(";")?n:n.replace(Xr,mt))},v.uniqueId=function(n){var t=++m; +return pr(null==n?"":n)+t},v.all=Rt,v.any=zt,v.detect=Tt,v.findWhere=Tt,v.foldl=Bt,v.foldr=Lt,v.include=Nt,v.inject=Bt,Zt(function(){var n={};return wt(v,function(t,r){v.prototype[r]||(n[r]=t)}),n}(),false),v.first=Kt,v.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:h;return s(n,qr(0,u-e))},v.sample=function(n,t,r){return n&&typeof n.length!="number"?n=At(n):Mr.unindexedChars&&It(n)&&(n=n.split("")),null==t||r?n?n[ft(0,n.length-1)]:h:(n=Wt(n),n.length=Br(qr(0,t),n.length),n) +},v.take=Kt,v.head=Kt,wt(v,function(n,t){var r="sample"!==t;v.prototype[t]||(v.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new y(o,u):o})}),v.VERSION="2.4.1",v.prototype.chain=function(){return this.__chain__=true,this},v.prototype.toString=function(){return pr(this.__wrapped__)},v.prototype.value=rr,v.prototype.valueOf=rr,ut(["join","pop","shift"],function(n){var t=gr[n];v.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); +return n?new y(r,n):r}}),ut(["push","reverse","sort","unshift"],function(n){var t=gr[n];v.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ut(["concat","slice","splice"],function(n){var t=gr[n];v.prototype[n]=function(){return new y(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Mr.spliceObjects||ut(["pop","shift","splice"],function(n){var t=gr[n],r="splice"==n;v.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new y(u,n):u +}}),v}var h,v=[],y=[],m=0,d=+new Date+"",b=75,_=40,w=" \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",j=/\b__p\+='';/g,x=/\b(__p\+=)''\+/g,C=/(__e\(.*?\)|\b__t\))\+'';/g,k=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,E=/^\s*function[ \n\r\t]+\w/,S=/<%-([\s\S]+?)%>/g,I=/<%([\s\S]+?)%>/g,A=/<%=([\s\S]+?)%>/g,N=RegExp("^["+w+"]*0+(?=.$)"),R=/($^)/,P=/\bthis\b/,T=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Error Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),F="[object Arguments]",q="[object Array]",B="[object Boolean]",L="[object Date]",W="[object Error]",z="[object Function]",K="[object Number]",M="[object Object]",V="[object RegExp]",U="[object String]",G={}; +G[z]=false,G[F]=G[q]=G[B]=G[L]=G[K]=G[M]=G[V]=G[U]=true;var H={leading:false,maxWait:0,trailing:false},J={configurable:false,enumerable:false,value:null,writable:false},Q={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},X={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Y=Q[typeof window]&&window||this,Z=Q[typeof exports]&&exports&&!exports.nodeType&&exports,nt=Q[typeof module]&&module&&!module.nodeType&&module,tt=nt&&nt.exports===Z&&Z,rt=Q[typeof global]&&global; +!rt||rt.global!==rt&&rt.window!==rt||(Y=rt);var et=g();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Y._=et, define(function(){return et})):Z&&nt?tt?(nt.exports=et)._=et:Z._=et:Y._=et}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index c64e16117..b2e71a249 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -57,8 +57,10 @@ /** Used to detected named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match leading whitespace and zeros to be removed */ var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); @@ -535,16 +537,16 @@ * * The chainable wrapper functions are: * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` + * `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, + * `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, + * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `map`, `mapValues`, `max`, `memoize`, `merge`, + * `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, + * `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, + * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, @@ -552,12 +554,12 @@ * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` + * `lastIndexOf`, `mixin`, `noConflict`, `now`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, + * `runInContext`, `template`, `unescape`, `uniqueId`, and `value` * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. + * The wrapper functions `first`, `last`, and `sample` return wrapped values + * when `n` is provided, otherwise they return unwrapped values. * * Explicit chaining can be enabled by using the `_.chain` method. * @@ -660,7 +662,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'escape': /<%-([\s\S]+?)%>/g, + 'escape': reEscape, /** * Used to detect code to be evaluated. @@ -668,7 +670,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'evaluate': /<%([\s\S]+?)%>/g, + 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. @@ -1602,14 +1604,15 @@ */ var shimKeys = function(object) { var result = []; - if (!(object && objectTypes[typeof object])) return result; - if (!(objectTypes[typeof object])) return result; - for (var key in object) { - if (hasOwnProperty.call(object, key)) { - result.push(key); - } + if (!(object && objectTypes[typeof object])) { + return result; } - return result + for (var key in object) { + if (hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; }; /** @@ -2026,12 +2029,16 @@ */ var forIn = function(object, callback, thisArg) { var result = object; - if (!(object && objectTypes[typeof object])) return result; + if (!(object && objectTypes[typeof object])) { + return result; + } callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); for (var key in object) { - if (callback(object[key], key, object) === false) return result; + if (callback(object[key], key, object) === false) { + return result; + } } - return result + return result; }; /** diff --git a/dist/lodash.min.js b/dist/lodash.min.js index d3d0ca17b..f07cde8bc 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,52 +4,52 @@ * Build: `lodash modern -o ./dist/lodash.js` */ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++ea||typeof i=="undefined")return 1;if(ie?0:e);++r=b&&i===n,l=[]; -if(f){var p=o(r);p?(i=t,r=p):f=false}for(;++ui(r,p)&&l.push(p);return f&&c(r),l}function tt(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r=b&&f===n,v=u||h?a():s;for(h&&(v=o(v),f=t);++if(v,y))&&((u||h)&&v.push(y),s.push(g)) -}return h?(l(v.g),c(v)):u&&l(v),s}function it(n){return function(t,e,r){var u={};e=d.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Re(0,o+e):e)||0,Be(n)?i=-1o&&(o=a)}}else t=null==t&&xt(n)?r:d.createCallback(t,e,3),Rt(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Dt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=d.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;return t=d.createCallback(t,r,4),St(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) -}),e}function Ft(n){var t=-1,e=n?n.length:0,r=Yt(typeof e=="number"?e:0);return Rt(n,function(n){var e=ut(0,++t);r[t]=r[e],r[e]=n}),r}function Bt(n,t,e){var r;t=d.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++er?Re(0,u+r):r||0}else if(r)return r=Pt(t,e),t[r]===e?r:-1;return n(t,e,r)}function zt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=d.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t=h;m?(i&&(i=ge(i)),s=f,a=n.apply(l,o)):i||(i=we(r,h))}return m&&c?c=ge(c):c||t===v||(c=we(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Gt(n){return n}function Ht(n,t,e){var r=true,u=t&&bt(t); -t&&(e||u.length)||(null==e&&(e=t),o=U,t=n,n=d,u=bt(t)),false===e?r=false:jt(e)&&"chain"in e&&(r=e.chain);var o=n,i=wt(o);Rt(u,function(e){var u=n[e]=t[e];i&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,i=[e];if(_e.apply(i,arguments),i=u.apply(n,i),r||t){if(e===i&&jt(i))return this;i=new o(i),i.__chain__=t}return i})})}function Jt(){}function Qt(n){return function(t){return t[n]}}function Xt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,T)):G;var Yt=e.Array,Zt=e.Boolean,ne=e.Date,te=e.Function,ee=e.Math,re=e.Number,ue=e.Object,oe=e.RegExp,ie=e.String,ae=e.TypeError,fe=[],le=ue.prototype,ce=(ce=e.window)&&ce.document,pe=e._,se=le.toString,he=oe("^"+ie(se).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ve=ee.ceil,ge=e.clearTimeout,ye=ee.floor,me=te.prototype.toString,be=ct(be=ue.getPrototypeOf)&&be,de=le.hasOwnProperty,_e=fe.push,we=e.setTimeout,je=fe.splice,ke=fe.unshift,xe=function(){try{var n={},t=ct(t=ue.defineProperty)&&t,e=t(n,n,n)&&t -}catch(r){}return e}(),Ce=ct(Ce=ue.create)&&Ce,Oe=ct(Oe=Yt.isArray)&&Oe,Ee=e.isFinite,Ne=e.isNaN,Ie=ct(Ie=ue.keys)&&Ie,Re=ee.max,Se=ee.min,Te=e.parseInt,Ae=ee.random,De={};De[D]=Yt,De[$]=Zt,De[F]=ne,De[B]=te,De[q]=ue,De[W]=re,De[z]=oe,De[P]=ie,U.prototype=d.prototype;var $e=d.support={};$e.dom=!!ce&&typeof ce=="object"&&he.test(ge)&&he.test(we),$e.funcDecomp=!ct(e.WinRTError)&&R.test(s),$e.funcNames=typeof te.name=="string",d.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:d}},Ce||(Q=function(){function n(){}return function(t){if(jt(t)){n.prototype=t; -var r=new n;n.prototype=null}return r||e.Object()}}());var Fe=xe?function(n,t){M.value=t,xe(n,"__bindData__",M)}:Jt,Be=Oe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&se.call(n)==D||false},We=Ie?function(n){return jt(n)?Ie(n):[]}:g,qe={"&":"&","<":"<",">":">",'"':""","'":"'"},ze=dt(qe),Pe=oe("("+We(ze).join("|")+")","g"),Ke=oe("["+We(qe).join("")+"]","g");$e.dom||(_t=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!Le(n)||false});var Le=be?function(n){if(!n||se.call(n)!=q)return false; -var t=n.valueOf,e=ct(t)&&(e=be(t))&&be(e);return e?n==e||be(n)==e:pt(n)}:pt,Me=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),Ve=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),Ue=it(function(n,t,e){n[e]=t}),Ge=Tt,He=ct(He=ne.now)&&He||function(){return(new ne).getTime()},Je=8==Te(_+"08")?Te:function(n,t){return Te(xt(n)?n.replace(N,""):n,t||0)};return d.after=function(n,t){if(!wt(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},d.assign=vt,d.at=function(n){for(var t=arguments,e=-1,r=tt(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Yt(t);++e=b&&o(r?e[r]:s)))}var p=e[0],v=-1,g=p?p.length:0,y=[];n:for(;++v(m?t(m,h):f(s,h))){for(r=u,(m||s).push(h);--r;)if(m=i[r],0>(m?t(m,h):f(e[r],h)))continue n;y.push(h)}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},d.invert=dt,d.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=Yt(typeof o=="number"?o:0);return Rt(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},d.keys=We,d.map=Tt,d.mapValues=function(n,t,e){var r={}; -return t=d.createCallback(t,e,3),yt(n,function(n,e,u){r[e]=t(n,e,u)}),r},d.max=At,d.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!wt(n))throw new ae;return e.cache={},e},d.merge=function(n){var t=arguments,e=2;if(!jt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3e?Re(0,r+e):Se(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},d.mixin=Ht,d.noConflict=function(){return e._=pe,this},d.noop=Jt,d.now=He,d.parseInt=Je,d.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Ae(),Se(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):ut(n,t) -},d.reduce=Dt,d.reduceRight=$t,d.result=function(n,t){if(n){var e=n[t];return wt(e)?n[t]():e}},d.runInContext=s,d.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:We(n).length},d.some=Bt,d.sortedIndex=Pt,d.template=function(n,t,e){var r=d.templateSettings;n=ie(n||""),e=gt({},e,r);var u,o=gt({},e.imports,r.imports),r=We(o),o=Ct(o),a=0,f=e.interpolate||I,l="__p+='",f=oe((e.escape||I).source+"|"+f.source+"|"+(f===E?x:I).source+"|"+(e.evaluate||I).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(S,i),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t -}),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(w,""):l).replace(j,"$1").replace(k,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=te(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},d.unescape=function(n){return null==n?"":(n=ie(n),0>n.indexOf(";")?n:n.replace(Pe,st))},d.uniqueId=function(n){var t=++y; -return ie(null==n?"":n)+t},d.all=Et,d.any=Bt,d.detect=It,d.findWhere=It,d.foldl=Dt,d.foldr=$t,d.include=Ot,d.inject=Dt,Ht(function(){var n={};return yt(d,function(t,e){d.prototype[e]||(n[e]=t)}),n}(),false),d.first=Wt,d.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=d.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return p(n,Re(0,u-r))},d.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=Ct(n)),null==t||e?n?n[ut(0,n.length-1)]:h:(n=Ft(n),n.length=Se(Re(0,t),n.length),n) -},d.take=Wt,d.head=Wt,yt(d,function(n,t){var e="sample"!==t;d.prototype[t]||(d.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new U(o,u):o})}),d.VERSION="2.4.1",d.prototype.chain=function(){return this.__chain__=true,this},d.prototype.toString=function(){return ie(this.__wrapped__)},d.prototype.value=Xt,d.prototype.valueOf=Xt,Rt(["join","pop","shift"],function(n){var t=fe[n];d.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); -return n?new U(e,n):e}}),Rt(["push","reverse","sort","unshift"],function(n){var t=fe[n];d.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Rt(["concat","slice","splice"],function(n){var t=fe[n];d.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments),this.__chain__)}}),d}var h,v=[],g=[],y=0,m=+new Date+"",b=75,d=40,_=" \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",w=/\b__p\+='';/g,j=/\b(__p\+=)''\+/g,k=/(__e\(.*?\)|\b__t\))\+'';/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,E=/<%=([\s\S]+?)%>/g,N=RegExp("^["+_+"]*0+(?=.$)"),I=/($^)/,R=/\bthis\b/,S=/['\n\r\t\u2028\u2029\\]/g,T="Array Boolean Date Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),A="[object Arguments]",D="[object Array]",$="[object Boolean]",F="[object Date]",B="[object Function]",W="[object Number]",q="[object Object]",z="[object RegExp]",P="[object String]",K={}; -K[B]=false,K[A]=K[D]=K[$]=K[F]=K[W]=K[q]=K[z]=K[P]=true;var L={leading:false,maxWait:0,trailing:false},M={configurable:false,enumerable:false,value:null,writable:false},V={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},U={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},G=V[typeof window]&&window||this,H=V[typeof exports]&&exports&&!exports.nodeType&&exports,J=V[typeof module]&&module&&!module.nodeType&&module,Q=J&&J.exports===H&&H,X=V[typeof global]&&global;!X||X.global!==X&&X.window!==X||(G=X); -var Y=s();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(G._=Y, define(function(){return Y})):H&&J?Q?(J.exports=Y)._=Y:H._=Y:G._=Y}).call(this); \ No newline at end of file +}}function r(n){return n.charCodeAt(0)}function u(n,t){for(var e=n.i,r=t.i,u=-1,o=e.length;++ua||typeof i=="undefined")return 1;if(ie?0:e);++r=b&&i===n,l=[]; +if(f){var p=o(r);p?(i=t,r=p):f=false}for(;++ui(r,p)&&l.push(p);return f&&c(r),l}function rt(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r=b&&f===n,v=u||h?a():s;for(h&&(v=o(v),f=t);++if(v,y))&&((u||h)&&v.push(y),s.push(g)) +}return h?(l(v.g),c(v)):u&&l(v),s}function ft(n){return function(t,e,r){var u={};e=d.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Te(0,o+e):e)||0,qe(n)?i=-1o&&(o=a)}}else t=null==t&&Ot(n)?r:d.createCallback(t,e,3),Tt(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Ft(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=d.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;return t=d.createCallback(t,r,4),At(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) +}),e}function Wt(n){var t=-1,e=n?n.length:0,r=ne(typeof e=="number"?e:0);return Tt(n,function(n){var e=it(0,++t);r[t]=r[e],r[e]=n}),r}function qt(n,t,e){var r;t=d.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++er?Te(0,u+r):r||0}else if(r)return r=Lt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Kt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=d.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t=h;m?(i&&(i=me(i)),s=f,a=n.apply(l,o)):i||(i=ke(r,h))}return m&&c?c=me(c):c||t===v||(c=ke(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Jt(n){return n}function Qt(n,t,e){var r=true,u=t&&_t(t); +t&&(e||u.length)||(null==e&&(e=t),o=H,t=n,n=d,u=_t(t)),false===e?r=false:xt(e)&&"chain"in e&&(r=e.chain);var o=n,i=kt(o);Tt(u,function(e){var u=n[e]=t[e];i&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,i=[e];if(je.apply(i,arguments),i=u.apply(n,i),r||t){if(e===i&&xt(i))return this;i=new o(i),i.__chain__=t}return i})})}function Xt(){}function Yt(n){return function(t){return t[n]}}function Zt(){return this.__wrapped__}e=e?nt.defaults(J.Object(),e,nt.pick(J,D)):J;var ne=e.Array,te=e.Boolean,ee=e.Date,re=e.Function,ue=e.Math,oe=e.Number,ie=e.Object,ae=e.RegExp,fe=e.String,le=e.TypeError,ce=[],pe=ie.prototype,se=(se=e.window)&&se.document,he=e._,ve=pe.toString,ge=ae("^"+fe(ve).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ye=ue.ceil,me=e.clearTimeout,be=ue.floor,de=re.prototype.toString,_e=st(_e=ie.getPrototypeOf)&&_e,we=pe.hasOwnProperty,je=ce.push,ke=e.setTimeout,xe=ce.splice,Ce=ce.unshift,Oe=function(){try{var n={},t=st(t=ie.defineProperty)&&t,e=t(n,n,n)&&t +}catch(r){}return e}(),Ee=st(Ee=ie.create)&&Ee,Ne=st(Ne=ne.isArray)&&Ne,Ie=e.isFinite,Re=e.isNaN,Se=st(Se=ie.keys)&&Se,Te=ue.max,Ae=ue.min,De=e.parseInt,$e=ue.random,Fe={};Fe[F]=ne,Fe[B]=te,Fe[W]=ee,Fe[q]=re,Fe[P]=ie,Fe[z]=oe,Fe[K]=ae,Fe[L]=fe,H.prototype=d.prototype;var Be=d.support={};Be.dom=!!se&&typeof se=="object"&&ge.test(me)&&ge.test(ke),Be.funcDecomp=!st(e.WinRTError)&&T.test(s),Be.funcNames=typeof re.name=="string",d.templateSettings={escape:E,evaluate:N,interpolate:I,variable:"",imports:{_:d}},Ee||(Y=function(){function n(){}return function(t){if(xt(t)){n.prototype=t; +var r=new n;n.prototype=null}return r||e.Object()}}());var We=Oe?function(n,t){U.value=t,Oe(n,"__bindData__",U)}:Xt,qe=Ne||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ve.call(n)==F||false},ze=Se?function(n){return xt(n)?Se(n):[]}:g,Pe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ke=wt(Pe),Le=ae("("+ze(Ke).join("|")+")","g"),Me=ae("["+ze(Pe).join("")+"]","g");Be.dom||(jt=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!Ve(n)||false});var Ve=_e?function(n){if(!n||ve.call(n)!=P)return false; +var t=n.valueOf,e=st(t)&&(e=_e(t))&&_e(e);return e?n==e||_e(n)==e:ht(n)}:ht,Ue=ft(function(n,t,e){we.call(n,e)?n[e]++:n[e]=1}),Ge=ft(function(n,t,e){(we.call(n,e)?n[e]:n[e]=[]).push(t)}),He=ft(function(n,t,e){n[e]=t}),Je=Dt,Qe=st(Qe=ee.now)&&Qe||function(){return(new ee).getTime()},Xe=8==De(_+"08")?De:function(n,t){return De(Ot(n)?n.replace(R,""):n,t||0)};return d.after=function(n,t){if(!kt(t))throw new le;return function(){return 1>--n?t.apply(this,arguments):void 0}},d.assign=yt,d.at=function(n){for(var t=arguments,e=-1,r=rt(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=ne(t);++e=b&&o(r?e[r]:s)))}var p=e[0],v=-1,g=p?p.length:0,y=[];n:for(;++v(m?t(m,h):f(s,h))){for(r=u,(m||s).push(h);--r;)if(m=i[r],0>(m?t(m,h):f(e[r],h)))continue n;y.push(h)}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},d.invert=wt,d.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=ne(typeof o=="number"?o:0);return Tt(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},d.keys=ze,d.map=Dt,d.mapValues=function(n,t,e){var r={}; +return t=d.createCallback(t,e,3),bt(n,function(n,e,u){r[e]=t(n,e,u)}),r},d.max=$t,d.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return we.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!kt(n))throw new le;return e.cache={},e},d.merge=function(n){var t=arguments,e=2;if(!xt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3e?Te(0,r+e):Ae(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},d.mixin=Qt,d.noConflict=function(){return e._=he,this},d.noop=Xt,d.now=Qe,d.parseInt=Xe,d.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=$e(),Ae(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):it(n,t) +},d.reduce=Ft,d.reduceRight=Bt,d.result=function(n,t){if(n){var e=n[t];return kt(e)?n[t]():e}},d.runInContext=s,d.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ze(n).length},d.some=qt,d.sortedIndex=Lt,d.template=function(n,t,e){var r=d.templateSettings;n=fe(n||""),e=mt({},e,r);var u,o=mt({},e.imports,r.imports),r=ze(o),o=Et(o),a=0,f=e.interpolate||S,l="__p+='",f=ae((e.escape||S).source+"|"+f.source+"|"+(f===I?x:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(A,i),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t +}),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(w,""):l).replace(j,"$1").replace(k,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=re(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},d.unescape=function(n){return null==n?"":(n=fe(n),0>n.indexOf(";")?n:n.replace(Le,vt))},d.uniqueId=function(n){var t=++y; +return fe(null==n?"":n)+t},d.all=It,d.any=qt,d.detect=St,d.findWhere=St,d.foldl=Ft,d.foldr=Bt,d.include=Nt,d.inject=Ft,Qt(function(){var n={};return bt(d,function(t,e){d.prototype[e]||(n[e]=t)}),n}(),false),d.first=zt,d.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=d.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return p(n,Te(0,u-r))},d.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=Et(n)),null==t||e?n?n[it(0,n.length-1)]:h:(n=Wt(n),n.length=Ae(Te(0,t),n.length),n) +},d.take=zt,d.head=zt,bt(d,function(n,t){var e="sample"!==t;d.prototype[t]||(d.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new H(o,u):o})}),d.VERSION="2.4.1",d.prototype.chain=function(){return this.__chain__=true,this},d.prototype.toString=function(){return fe(this.__wrapped__)},d.prototype.value=Zt,d.prototype.valueOf=Zt,Tt(["join","pop","shift"],function(n){var t=ce[n];d.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); +return n?new H(e,n):e}}),Tt(["push","reverse","sort","unshift"],function(n){var t=ce[n];d.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Tt(["concat","slice","splice"],function(n){var t=ce[n];d.prototype[n]=function(){return new H(t.apply(this.__wrapped__,arguments),this.__chain__)}}),d}var h,v=[],g=[],y=0,m=+new Date+"",b=75,d=40,_=" \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",w=/\b__p\+='';/g,j=/\b(__p\+=)''\+/g,k=/(__e\(.*?\)|\b__t\))\+'';/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,E=/<%-([\s\S]+?)%>/g,N=/<%([\s\S]+?)%>/g,I=/<%=([\s\S]+?)%>/g,R=RegExp("^["+_+"]*0+(?=.$)"),S=/($^)/,T=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),$="[object Arguments]",F="[object Array]",B="[object Boolean]",W="[object Date]",q="[object Function]",z="[object Number]",P="[object Object]",K="[object RegExp]",L="[object String]",M={}; +M[q]=false,M[$]=M[F]=M[B]=M[W]=M[z]=M[P]=M[K]=M[L]=true;var V={leading:false,maxWait:0,trailing:false},U={configurable:false,enumerable:false,value:null,writable:false},G={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},H={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},J=G[typeof window]&&window||this,Q=G[typeof exports]&&exports&&!exports.nodeType&&exports,X=G[typeof module]&&module&&!module.nodeType&&module,Y=X&&X.exports===Q&&Q,Z=G[typeof global]&&global;!Z||Z.global!==Z&&Z.window!==Z||(J=Z); +var nt=s();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(J._=nt, define(function(){return nt})):Q&&X?Y?(X.exports=nt)._=nt:Q._=nt:J._=nt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 00aab5ea5..c3fec2a4b 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -21,8 +21,10 @@ /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ var keyPrefix = +new Date + ''; - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -240,16 +242,16 @@ * * The chainable wrapper functions are: * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` + * `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, + * `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, + * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `map`, `mapValues`, `max`, `memoize`, `merge`, + * `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, + * `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, + * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, @@ -257,12 +259,12 @@ * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` + * `lastIndexOf`, `mixin`, `noConflict`, `now`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, + * `runInContext`, `template`, `unescape`, `uniqueId`, and `value` * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. + * The wrapper functions `first`, `last`, and `sample` return wrapped values + * when `n` is provided, otherwise they return unwrapped values. * * Explicit chaining can be enabled by using the `_.chain` method. * @@ -357,7 +359,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'escape': /<%-([\s\S]+?)%>/g, + 'escape': reEscape, /** * Used to detect code to be evaluated. @@ -365,7 +367,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'evaluate': /<%([\s\S]+?)%>/g, + 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. @@ -950,14 +952,15 @@ */ var shimKeys = function(object) { var result = []; - if (!(object && objectTypes[typeof object])) return result; - if (!(objectTypes[typeof object])) return result; - for (var key in object) { - if (hasOwnProperty.call(object, key)) { - result.push(key); - } + if (!(object && objectTypes[typeof object])) { + return result; } - return result + for (var key in object) { + if (hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; }; /** @@ -1164,11 +1167,15 @@ */ var forIn = function(object, callback) { var result = object; - if (!(object && objectTypes[typeof object])) return result; - for (var key in object) { - if (callback(object[key], key, object) === indicatorObject) return result; + if (!(object && objectTypes[typeof object])) { + return result; } - return result + for (var key in object) { + if (callback(object[key], key, object) === indicatorObject) { + return result; + } + } + return result; }; /** diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 161428762..1c753d4e3 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -22,7 +22,7 @@ return u}function L(n,r,t,e){return typeof r!="boolean"&&null!=r&&(e=t,t=typeof return function(r){for(var t=u.length,e=false;t--&&(e=r[u[t]]===n[u[t]]););return e}}function Z(n){return n}function nr(n){I(T(n),function(r){var t=u[r]=n[r];u.prototype[r]=function(){var n=[this.__wrapped__];return Fr.apply(n,arguments),n=t.apply(u,n),this.__chain__?new o(n,true):n}})}function rr(n){return function(r){return r[n]}}var tr,er=0,ur={},or=+new Date+"",ir=/($^)/,fr=/['\n\r\t\u2028\u2029\\]/g,ar="[object Arguments]",lr="[object Array]",cr="[object Boolean]",pr="[object Date]",sr="[object Number]",gr="[object Object]",hr="[object RegExp]",vr="[object String]",yr={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},mr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},_r=yr[typeof window]&&window||this,dr=yr[typeof exports]&&exports&&!exports.nodeType&&exports,br=yr[typeof module]&&module&&!module.nodeType&&module,wr=br&&br.exports===dr&&dr,jr=yr[typeof global]&&global; !jr||jr.global!==jr&&jr.window!==jr||(_r=jr);var xr=[],Tr=Object.prototype,Er=_r._,Ar=Tr.toString,Or=RegExp("^"+(Ar+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Sr=Math.ceil,kr=Math.floor,Nr=Function.prototype.toString,Rr=Tr.hasOwnProperty,Fr=xr.push,Br=Tr.propertyIsEnumerable,qr=_(qr=Object.create)&&qr,Dr=_(Dr=Array.isArray)&&Dr,Ir=_r.isFinite,Mr=_r.isNaN,$r=_($r=Object.keys)&&$r,Wr=Math.max,zr=Math.min,Cr=Math.random;o.prototype=u.prototype;var Pr={};!function(){var n={0:1,length:1}; Pr.spliceObjects=(xr.splice.call(n,0,1),!n[0])}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},qr||(f=function(){function n(){}return function(r){if(S(r)){n.prototype=r;var t=new n;n.prototype=null}return t||_r.Object()}}()),b(arguments)||(b=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Rr.call(n,"callee")&&!Br.call(n,"callee")||false});var Ur=Dr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ar.call(n)==lr||false -},Vr=function(n){var r=[];if(!n||!yr[typeof n]||!yr[typeof n])return r;for(var t in n)Rr.call(n,t)&&r.push(t);return r},Gr=$r?function(n){return S(n)?$r(n):[]}:Vr,Hr={"&":"&","<":"<",">":">",'"':""","'":"'"},Jr=E(Hr),Kr=RegExp("("+Gr(Jr).join("|")+")","g"),Lr=RegExp("["+Gr(Hr).join("")+"]","g"),Qr=function(n,r){if(!n||!yr[typeof n])return n;for(var t in n)if(r(n[t],t,n)===ur)break;return n};O(/x/)&&(O=function(n){return typeof n=="function"&&"[object Function]"==Ar.call(n)});var Xr=h(function(n,r,t){Rr.call(n,t)?n[t]++:n[t]=1 +},Vr=function(n){var r=[];if(!n||!yr[typeof n])return r;for(var t in n)Rr.call(n,t)&&r.push(t);return r},Gr=$r?function(n){return S(n)?$r(n):[]}:Vr,Hr={"&":"&","<":"<",">":">",'"':""","'":"'"},Jr=E(Hr),Kr=RegExp("("+Gr(Jr).join("|")+")","g"),Lr=RegExp("["+Gr(Hr).join("")+"]","g"),Qr=function(n,r){if(!n||!yr[typeof n])return n;for(var t in n)if(r(n[t],t,n)===ur)break;return n};O(/x/)&&(O=function(n){return typeof n=="function"&&"[object Function]"==Ar.call(n)});var Xr=h(function(n,r,t){Rr.call(n,t)?n[t]++:n[t]=1 }),Yr=h(function(n,r,t){(Rr.call(n,t)?n[t]:n[t]=[]).push(r)}),Zr=h(function(n,r,t){n[t]=r}),nt=$,rt=_(rt=Date.now)&&rt||function(){return(new Date).getTime()};u.after=function(n,r){if(!O(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=Q,u.bindAll=function(n){for(var r=1i(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n; diff --git a/doc/README.md b/doc/README.md index 76a3c33ce..c82604659 100644 --- a/doc/README.md +++ b/doc/README.md @@ -240,7 +240,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4495 "View in source") [Ⓣ][1] Creates an array with all falsey values removed. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are all falsey. @@ -264,7 +264,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4519 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4525 "View in source") [Ⓣ][1] Creates an array excluding all values of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -289,7 +289,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4564 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4570 "View in source") [Ⓣ][1] This method is like `_.find` except that it returns the index of the first element that passes the callback check, instead of the element itself. @@ -335,7 +335,7 @@ _.findIndex(characters, 'blocked'); ### `_.findLastIndex(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4618 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4624 "View in source") [Ⓣ][1] This method is like `_.findIndex` except that it iterates over elements of a `collection` from right to left. @@ -381,7 +381,7 @@ _.findLastIndex(characters, 'blocked'); ### `_.first(array, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4682 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4688 "View in source") [Ⓣ][1] Gets the first element or first `n` elements of an array. If a callback is provided elements at the beginning of the array are returned as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -438,7 +438,7 @@ _.pluck(_.first(characters, { 'employer': 'slate' }), 'name'); ### `_.flatten(array, [isShallow=false], [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4743 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4749 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truey, the array will only be flattened a single level. If a callback is provided each element of the array is passed through the callback before flattening. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -482,7 +482,7 @@ _.flatten(characters, 'pets'); ### `_.indexOf(array, value, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4782 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4788 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the array is already sorted providing `true` for `fromIndex` will run a faster binary search. @@ -516,7 +516,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array, [callback=1], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4845 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4851 "View in source") [Ⓣ][1] Gets all but the last element or last `n` elements of an array. If a callback is provided elements at the end of the array are excluded from the result as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -570,7 +570,7 @@ _.pluck(_.initial(characters, { 'employer': 'na' }), 'name'); ### `_.intersection([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4875 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4881 "View in source") [Ⓣ][1] Creates an array of unique values present in all provided arrays using strict equality for comparisons, i.e. `===`. @@ -594,7 +594,7 @@ _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); ### `_.last(array, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4977 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4983 "View in source") [Ⓣ][1] Gets the last element or last `n` elements of an array. If a callback is provided elements at the end of the array are returned as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -648,7 +648,7 @@ _.last(characters, { 'employer': 'na' }); ### `_.lastIndexOf(array, value, [fromIndex=array.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5024 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5030 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -682,7 +682,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.pull(array, [value])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5054 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5060 "View in source") [Ⓣ][1] Removes all provided values from the given array using strict equality for comparisons, i.e. `===`. @@ -709,7 +709,7 @@ console.log(array); ### `_.range([start=0], end, [step=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5105 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5111 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. If `start` is less than `stop` a zero-length range is created unless a negative `step` is specified. @@ -750,7 +750,7 @@ _.range(0); ### `_.remove(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5158 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5164 "View in source") [Ⓣ][1] Removes all elements from an array that the callback returns truey for and returns an array of removed elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -786,7 +786,7 @@ console.log(evens); ### `_.rest(array, [callback=1], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5229 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5235 "View in source") [Ⓣ][1] The opposite of `_.initial`; this method gets all but the first element or first `n` elements of an array. If a callback function is provided elements at the beginning of the array are excluded from the result as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -843,7 +843,7 @@ _.rest(characters, { 'employer': 'slate' }); ### `_.sortedIndex(array, value, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5295 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5301 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which a value should be inserted into a given sorted array in order to maintain the sort order of the array. If a callback is provided it will be executed for `value` and each element of `array` to compute their sort ranking. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -894,7 +894,7 @@ _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); ### `_.union([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5326 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5332 "View in source") [Ⓣ][1] Creates an array of unique values, in order, of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -918,7 +918,7 @@ _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); ### `_.uniq(array, [isSorted=false], [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5377 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5383 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of an array using strict equality for comparisons, i.e. `===`. If the array is sorted, providing `true` for `isSorted` will use a faster algorithm. If a callback is provided each element of `array` is passed through the callback before uniqueness is computed. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -968,7 +968,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.without(array, [value])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5405 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5411 "View in source") [Ⓣ][1] Creates an array excluding all provided values using strict equality for comparisons, i.e. `===`. @@ -993,7 +993,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.xor([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5426 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5432 "View in source") [Ⓣ][1] Creates an array that is the symmetric difference of the provided arrays. See [Wikipedia](http://en.wikipedia.org/wiki/Symmetric_difference) for more details. @@ -1020,7 +1020,7 @@ _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); ### `_.zip([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5467 "View in source") [Ⓣ][1] Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. If a zipped value is provided its corresponding unzipped value will be returned. @@ -1050,7 +1050,7 @@ _.unzip([['fred', 30, true], ['barney', 40, false]]); ### `_.zipObject(keys, [values=[]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5491 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5497 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Provide either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` or two arrays, one of `keys` and one of corresponding `values`. @@ -1085,7 +1085,7 @@ _.zipObject(['fred', 'barney'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L635 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L637 "View in source") [Ⓣ][1] Creates a `lodash` object which wraps the given value to enable intuitive method chaining. @@ -1095,12 +1095,12 @@ In addition to Lo-Dash methods, wrappers also have the following `Array` methods Chaining is supported in custom builds as long as the `value` method is implicitly or explicitly included in the build. The chainable wrapper functions are:
-`after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, and `zip` +`after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `mapValues`, `max`, `memoize`, `merge`, `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` The non-chainable wrapper functions are:
-`clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, `template`, `unescape`, `uniqueId`, and `value` +`clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `now`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, `template`, `unescape`, `uniqueId`, and `value` -The wrapper functions `first` and `last` return wrapped values when `n` is provided, otherwise they return unwrapped values. +The wrapper functions `first`, `last`, and `sample` return wrapped values when `n` is provided, otherwise they return unwrapped values. Explicit chaining can be enabled by using the `_.chain` method. @@ -1140,7 +1140,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6832 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6838 "View in source") [Ⓣ][1] Creates a `lodash` object that wraps the given value with explicit method chaining enabled. @@ -1174,7 +1174,7 @@ var youngest = _.chain(characters) ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6858 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6864 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument and then returns `value`. The purpose of this method is to "tap into" a method chain in order to perform operations on intermediate results within the chain. @@ -1202,7 +1202,7 @@ _([1, 2, 3, 4]) ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6888 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6894 "View in source") [Ⓣ][1] Enables explicit method chaining on the wrapper object. @@ -1236,7 +1236,7 @@ _(characters).chain() ### `_.prototype.toString()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6905 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6911 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1257,7 +1257,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6922 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6928 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1288,7 +1288,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection, [index])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3306 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3312 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1316,7 +1316,7 @@ _.at(['fred', 'barney', 'pebbles'], 0, 2); ### `_.contains(collection, target, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3349 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3355 "View in source") [Ⓣ][1] Checks if a given value is present in a collection using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1354,7 +1354,7 @@ _.contains('pebbles', 'eb'); ### `_.countBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3404 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of `collection` through the callback. The corresponding value of each key is the number of times the key was returned by the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1390,7 +1390,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3449 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3455 "View in source") [Ⓣ][1] Checks if the given callback returns truey value for **all** elements of a collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1436,7 +1436,7 @@ _.every(characters, { 'age': 36 }); ### `_.filter(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3510 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3516 "View in source") [Ⓣ][1] Iterates over elements of a collection, returning an array of all elements the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1482,7 +1482,7 @@ _.filter(characters, { 'age': 36 }); ### `_.find(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3577 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3583 "View in source") [Ⓣ][1] Iterates over elements of a collection, returning the first element that the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1531,7 +1531,7 @@ _.find(characters, 'blocked'); ### `_.findLast(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3622 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3628 "View in source") [Ⓣ][1] This method is like `_.find` except that it iterates over elements of a `collection` from right to left. @@ -1559,7 +1559,7 @@ _.findLast([1, 2, 3, 4], function(num) { ### `_.forEach(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3660 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3666 "View in source") [Ⓣ][1] Iterates over elements of a collection, executing the callback for each element. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1593,7 +1593,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); ### `_.forEachRight(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3693 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3699 "View in source") [Ⓣ][1] This method is like `_.forEach` except that it iterates over elements of a `collection` from right to left. @@ -1622,7 +1622,7 @@ _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); ### `_.groupBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3754 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3760 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of a collection through the callback. The corresponding value of each key is an array of the elements responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1659,7 +1659,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.indexBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3797 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3803 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of the collection through the given callback. The corresponding value of each key is the last element responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1700,7 +1700,7 @@ _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String); ### `_.invoke(collection, methodName, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3823 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3829 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection` returning an array of the results of each invoked method. Additional arguments will be provided to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1729,7 +1729,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3875 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3881 "View in source") [Ⓣ][1] Creates an array of values by running each element in the collection through the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1774,7 +1774,7 @@ _.map(characters, 'name'); ### `_.max(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3933 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3939 "View in source") [Ⓣ][1] Retrieves the maximum value of a collection. If the collection is empty or falsey `-Infinity` is returned. If a callback is provided it will be executed for each value in the collection to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1816,7 +1816,7 @@ _.max(characters, 'age'); ### `_.min(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4008 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4014 "View in source") [Ⓣ][1] Retrieves the minimum value of a collection. If the collection is empty or falsey `Infinity` is returned. If a callback is provided it will be executed for each value in the collection to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1858,7 +1858,7 @@ _.min(characters, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4063 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4069 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the collection. @@ -1888,7 +1888,7 @@ _.pluck(characters, 'name'); ### `_.reduce(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4095 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4101 "View in source") [Ⓣ][1] Reduces a collection to a value which is the accumulated result of running each element in the collection through the callback, where each successive callback execution consumes the return value of the previous execution. If `accumulator` is not provided the first element of the collection will be used as the initial `accumulator` value. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1926,7 +1926,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4138 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4144 "View in source") [Ⓣ][1] This method is like `_.reduce` except that it iterates over elements of a `collection` from right to left. @@ -1957,7 +1957,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4187 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4193 "View in source") [Ⓣ][1] The opposite of `_.filter`; this method returns the elements of a collection that the callback does **not** return truey for. @@ -2000,7 +2000,7 @@ _.reject(characters, { 'age': 36 }); ### `_.sample(collection, [n])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4213 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4219 "View in source") [Ⓣ][1] Retrieves a random element or `n` random elements from a collection. @@ -2028,7 +2028,7 @@ _.sample([1, 2, 3, 4], 2); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4241 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4247 "View in source") [Ⓣ][1] Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. See [Wikipedia](http://en.wikipedia.org/wiki/Fisher-Yates_shuffle) for more details. @@ -2052,7 +2052,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4274 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4280 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -2082,7 +2082,7 @@ _.size('pebbles'); ### `_.some(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4327 "View in source") [Ⓣ][1] Checks if the callback returns a truey value for **any** element of a collection. The function returns as soon as it finds a passing value and does not iterate over the entire collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -2128,7 +2128,7 @@ _.some(characters, { 'age': 1 }); ### `_.sortBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4391 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4397 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in a collection through the callback. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -2178,7 +2178,7 @@ _.map(_.sortBy(characters, ['name', 'age']), _.values); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4437 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4443 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -2202,7 +2202,7 @@ Converts the `collection` to an array. ### `_.where(collection, props)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4471 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4477 "View in source") [Ⓣ][1] Performs a deep comparison of each element in a `collection` to the given `properties` object, returning an array of all elements that have equivalent property values. @@ -2242,7 +2242,7 @@ _.where(characters, { 'pets': ['dino'] }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5536 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5542 "View in source") [Ⓣ][1] Creates a function that executes `func`, with the `this` binding and arguments of the created function, only after being called `n` times. @@ -2275,7 +2275,7 @@ _.forEach(saves, function(type) { ### `_.bind(func, [thisArg], [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5569 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5575 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those provided to the bound function. @@ -2306,7 +2306,7 @@ func(); ### `_.bindAll(object, [methodName])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5599 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5605 "View in source") [Ⓣ][1] 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. @@ -2337,7 +2337,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5646 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5652 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those provided to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See [Peter Michaux's article](http://michaux.ca/articles/lazy-function-definition-pattern) for more details. @@ -2378,7 +2378,7 @@ func(); ### `_.compose([func])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5682 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5688 "View in source") [Ⓣ][1] Creates a function that is the composition of the provided functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2416,7 +2416,7 @@ welcome('pebbles'); ### `_.curry(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5730 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5736 "View in source") [Ⓣ][1] Creates a function which accepts one or more arguments of `func` that when invoked either executes `func` returning its result, if all `func` arguments have been provided, or returns a function that accepts one or more of the remaining `func` arguments, and so on. The arity of `func` can be specified if `func.length` is not sufficient. @@ -2451,7 +2451,7 @@ curried(1, 2, 3); ### `_.debounce(func, wait, [options], [options.maxWait])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5774 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5780 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2495,7 +2495,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5890 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5896 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be provided to `func` when it is invoked. @@ -2520,7 +2520,7 @@ _.defer(function(text) { console.log(text); }, 'deferred'); ### `_.delay(func, wait, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5914 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5920 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be provided to `func` when it is invoked. @@ -2546,7 +2546,7 @@ _.delay(function(text) { console.log(text); }, 1000, 'later'); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5965 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is provided it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2589,7 +2589,7 @@ get('pebbles'); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5992 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5998 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2615,7 +2615,7 @@ initialize(); ### `_.partial(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6030 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6036 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those provided to the new function. This method is similar to `_.bind` except it does **not** alter the `this` binding. @@ -2642,7 +2642,7 @@ hi('fred'); ### `_.partialRight(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6061 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6067 "View in source") [Ⓣ][1] This method is like `_.partial` except that `partial` arguments are appended to those provided to the new function. @@ -2679,7 +2679,7 @@ options.imports ### `_.throttle(func, wait, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6102 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2715,7 +2715,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6137 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6143 "View in source") [Ⓣ][1] Creates a function that provides `value` to the wrapper function as its first argument. Additional arguments provided to the function are appended to those provided to the wrapper function. The wrapper is executed with the `this` binding of the created function. @@ -2751,7 +2751,7 @@ p('Fred, Wilma, & Pebbles'); ### `_.assign(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2011 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2017 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the assigned values. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2789,7 +2789,7 @@ defaults(object, { 'name': 'fred', 'employer': 'slate' }); ### `_.clone(value, [isDeep=false], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2077 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2083 "View in source") [Ⓣ][1] Creates a clone of `value`. If `isDeep` is `true` nested objects will also be cloned, otherwise they will be assigned by reference. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2836,7 +2836,7 @@ clone.childNodes.length; ### `_.cloneDeep(value, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2130 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2136 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2882,7 +2882,7 @@ clone.node == view.node; ### `_.create(prototype, [properties])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2165 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2171 "View in source") [Ⓣ][1] Creates an object that inherits from the given `prototype` object. If a `properties` object is provided its own enumerable properties are assigned to the created object. @@ -2922,7 +2922,7 @@ circle instanceof Shape; ### `_.defaults(object, [source])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2189 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2195 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2948,7 +2948,7 @@ _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); ### `_.findKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2253 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2259 "View in source") [Ⓣ][1] This method is like `_.findIndex` except that it returns the key of the first element that passes the callback check, instead of the element itself. @@ -2994,7 +2994,7 @@ _.findKey(characters, 'blocked'); ### `_.findLastKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2306 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2312 "View in source") [Ⓣ][1] This method is like `_.findKey` except that it iterates over elements of a `collection` in the opposite order. @@ -3040,7 +3040,7 @@ _.findLastKey(characters, 'blocked'); ### `_.forIn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2349 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2355 "View in source") [Ⓣ][1] Iterates over own and inherited enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3078,7 +3078,7 @@ _.forIn(new Shape, function(value, key) { ### `_.forInRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2385 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2391 "View in source") [Ⓣ][1] This method is like `_.forIn` except that it iterates over elements of a `collection` in the opposite order. @@ -3116,7 +3116,7 @@ _.forInRight(new Shape, function(value, key) { ### `_.forOwn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2422 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2428 "View in source") [Ⓣ][1] Iterates over own enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3144,7 +3144,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.forOwnRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2455 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2461 "View in source") [Ⓣ][1] This method is like `_.forOwn` except that it iterates over elements of a `collection` in the opposite order. @@ -3172,7 +3172,7 @@ _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2484 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2490 "View in source") [Ⓣ][1] Creates a sorted array of property names of all enumerable properties, own and inherited, of `object` that have function values. @@ -3199,7 +3199,7 @@ _.functions(_); ### `_.has(object, key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2509 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2515 "View in source") [Ⓣ][1] Checks if the specified property name exists as a direct property of `object`, instead of an inherited property. @@ -3224,7 +3224,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object, [multiValue=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2538 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2544 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given object. If the given object contains duplicate values, subsequent values will overwrite property assignments of previous values unless `multiValue` is `true`. @@ -3257,7 +3257,7 @@ _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }, true); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1882 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1888 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -3284,7 +3284,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1911 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1917 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -3311,7 +3311,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2574 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2580 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -3335,7 +3335,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2592 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2598 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -3359,7 +3359,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2609 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2615 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -3383,7 +3383,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2642 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2648 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -3413,7 +3413,7 @@ _.isEmpty(''); ### `_.isEqual(a, b, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2699 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2705 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If a callback is provided it will be executed to compare values. If the callback returns `undefined` comparisons will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -3458,7 +3458,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2732 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2738 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -3496,7 +3496,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2749 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2755 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -3520,7 +3520,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2813 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2819 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -3555,7 +3555,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2835 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2841 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3582,7 +3582,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2855 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2861 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3608,7 +3608,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2779 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2785 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3638,7 +3638,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2884 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2890 "View in source") [Ⓣ][1] Checks if `value` is an object created by the `Object` constructor. @@ -3673,7 +3673,7 @@ _.isPlainObject({ 'x': 0, 'y': 0 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2909 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2915 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3697,7 +3697,7 @@ _.isRegExp(/fred/); ### `_.isString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2926 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2932 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3721,7 +3721,7 @@ _.isString('fred'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2944 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2950 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3745,7 +3745,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1946 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1952 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of an object. @@ -3769,7 +3769,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.mapValues(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2984 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2990 "View in source") [Ⓣ][1] Creates an object with the same keys as `object` and values generated by running each own enumerable property of `object` through the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3808,7 +3808,7 @@ _.mapValues(characters, 'age'); ### `_.merge(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3045 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3051 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined` into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the merged values of the destination and source properties. If the callback returns `undefined` merging will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3864,7 +3864,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3101 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3107 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` omitting the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3895,7 +3895,7 @@ _.omit({ 'name': 'fred', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3142 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3148 "View in source") [Ⓣ][1] Creates a two dimensional array of an object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3919,7 +3919,7 @@ _.pairs({ 'barney': 36, 'fred': 40 }); ### `_.pick(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3182 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3188 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` picking the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3950,7 +3950,7 @@ _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { ### `_.transform(object, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3237 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3243 "View in source") [Ⓣ][1] An alternative to `_.reduce` this method transforms `object` to a new `accumulator` object which is the result of running each of its own enumerable properties through a 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`. @@ -3987,7 +3987,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3271 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3277 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -4018,7 +4018,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.now` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6387 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6393 "View in source") [Ⓣ][1] *(unknown)*: Gets the number of milliseconds that have elapsed since the Unix epoch *(1 January `1970 00`:00:00 UTC)*. @@ -4037,7 +4037,7 @@ _.defer(function() { console.log(_.now() - stamp); }); ### `_.constant(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6158 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6164 "View in source") [Ⓣ][1] Creates a function that returns `value`. @@ -4063,7 +4063,7 @@ getter() === object; ### `_.createCallback([func=identity], [thisArg], [argCount])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6195 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6201 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name the created callback will return the property value for a given element. If `func` is an object the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -4102,7 +4102,7 @@ _.filter(characters, 'age__gt38'); ### `_.escape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6247 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6253 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -4128,7 +4128,7 @@ _.escape('Fred, Wilma, & Pebbles'); ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6265 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6271 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -4153,7 +4153,7 @@ _.identity(object) === object; ### `_.mixin([object=lodash], source, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6297 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6303 "View in source") [Ⓣ][1] 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. @@ -4189,7 +4189,7 @@ _('fred').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6353 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6359 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -4209,7 +4209,7 @@ var lodash = _.noConflict(); ### `_.noop()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6370 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6376 "View in source") [Ⓣ][1] A no-operation function. @@ -4228,7 +4228,7 @@ _.noop(object) === undefined; ### `_.parseInt(value, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6411 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6417 "View in source") [Ⓣ][1] Converts the given value into an integer of the specified radix. If `radix` is `undefined` or `0` a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -4255,7 +4255,7 @@ _.parseInt('08'); ### `_.property(key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6440 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6446 "View in source") [Ⓣ][1] Creates a "_.pluck" style function, which returns the `key` value of a given object. @@ -4289,7 +4289,7 @@ _.sortBy(characters, getName); ### `_.random([min=0], [max=1], [floating=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6479 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. If `floating` is truey or either `min` or `max` are floats a floating-point number will be returned instead of an integer. @@ -4324,7 +4324,7 @@ _.random(1.2, 5.2); ### `_.result(object, key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6531 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6537 "View in source") [Ⓣ][1] Resolves the value of property `key` on `object`. If `key` is a function it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey then `undefined` is returned. @@ -4359,7 +4359,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=root])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L454 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L456 "View in source") [Ⓣ][1] Create a new `lodash` function using the given context object. @@ -4377,7 +4377,7 @@ Create a new `lodash` function using the given context object. ### `_.template(text, data, [options], [options.escape], [options.evaluate], [options.imports], [options.interpolate], [sourceURL], [variable])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6624 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6630 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4469,7 +4469,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6747 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6753 "View in source") [Ⓣ][1] Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*. @@ -4501,7 +4501,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6777 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6783 "View in source") [Ⓣ][1] The inverse of `_.escape`; this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -4527,7 +4527,7 @@ _.unescape('Fred, Barney & Pebbles'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6801 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6807 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is provided the ID will be appended to it. @@ -4561,7 +4561,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L863 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L865 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -4580,7 +4580,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7122 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7128 "View in source") [Ⓣ][1] *(string)*: The semantic version number. @@ -4592,7 +4592,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L664 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L666 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -4604,7 +4604,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L681 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L683 "View in source") [Ⓣ][1] *(boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -4616,7 +4616,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L689 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L691 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -4628,7 +4628,7 @@ A reference to the `lodash` function. ### `_.support.dom` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L699 "View in source") [Ⓣ][1] *(boolean)*: Detect if the DOM is supported. @@ -4640,7 +4640,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L706 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L708 "View in source") [Ⓣ][1] *(boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -4652,7 +4652,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L719 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L721 "View in source") [Ⓣ][1] *(boolean)*: Detect if `prototype` properties are enumerable by default. @@ -4666,7 +4666,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.funcDecomp` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L728 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L730 "View in source") [Ⓣ][1] *(boolean)*: Detect if functions can be decompiled by `Function#toString` *(all but PS3 and older Opera mobile browsers & avoided in Windows `8` apps)*. @@ -4678,7 +4678,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.funcNames` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L736 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L738 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Function#name` is supported *(all but IE)*. @@ -4690,7 +4690,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L745 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L747 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -4702,7 +4702,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L756 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L758 "View in source") [Ⓣ][1] *(boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -4716,7 +4716,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L764 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L766 "View in source") [Ⓣ][1] *(boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -4728,7 +4728,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L778 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L780 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -4742,7 +4742,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L789 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L791 "View in source") [Ⓣ][1] *(boolean)*: Detect lack of support for accessing string characters by index. @@ -4756,7 +4756,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L815 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L817 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -4768,7 +4768,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L823 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L825 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -4780,7 +4780,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L833 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -4792,7 +4792,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L839 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L841 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -4804,7 +4804,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L847 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L849 "View in source") [Ⓣ][1] *(string)*: Used to reference the data object in the template text. @@ -4816,7 +4816,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L855 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L857 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. diff --git a/lodash.js b/lodash.js index 8c61bda18..70b4e24bb 100644 --- a/lodash.js +++ b/lodash.js @@ -59,8 +59,10 @@ /** Used to detected named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match leading whitespace and zeros to be removed */ var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); @@ -580,16 +582,16 @@ * * The chainable wrapper functions are: * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` + * `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, + * `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, + * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, + * `invert`, `invoke`, `keys`, `map`, `mapValues`, `max`, `memoize`, `merge`, + * `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, + * `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, + * `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, @@ -597,12 +599,12 @@ * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` + * `lastIndexOf`, `mixin`, `noConflict`, `now`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, + * `runInContext`, `template`, `unescape`, `uniqueId`, and `value` * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. + * The wrapper functions `first`, `last`, and `sample` return wrapped values + * when `n` is provided, otherwise they return unwrapped values. * * Explicit chaining can be enabled by using the `_.chain` method. * @@ -820,7 +822,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'escape': /<%-([\s\S]+?)%>/g, + 'escape': reEscape, /** * Used to detect code to be evaluated. @@ -828,7 +830,7 @@ * @memberOf _.templateSettings * @type RegExp */ - 'evaluate': /<%([\s\S]+?)%>/g, + 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. @@ -876,8 +878,12 @@ var iteratorTemplate = template( // assign the `result` variable an initial value 'var result = <%= init %>;\n' + + // exit early if the first argument is not an object - 'if (!(object && objectTypes[typeof object])) return result;\n' + + 'if (!(object && objectTypes[typeof object])) {\n' + + ' return result;\n' + + '}\n' + + // add code before the iteration branches '<%= top %>;' + @@ -890,7 +896,7 @@ " key += '';\n" + ' <%= loop %>;\n' + ' }\n' + - ' return result\n' + + ' return result;\n' + '}' + '<% } %>' + @@ -914,9 +920,9 @@ // else using a for-in loop 'for (var key in object) {\n<%' + " if (useHas) { conditions.push('hasOwnProperty.call(object, key)'); }\n" + - " if (conditions.length) { %> if (<%= conditions.join(' && ') %>) {\n <% } %>" + + " if (conditions.length) { %> if (<%= conditions.join(' && ') %>) {\n <% } %>" + ' <%= loop %>;' + - ' <% if (conditions.length) { %>\n }<% } %>\n' + + ' <% if (conditions.length) { %>\n }<% } %>\n' + '}\n' + // Because IE < 9 can't set the `[[Enumerable]]` attribute of an @@ -929,18 +935,18 @@ ' isProto = object === (ctor && ctor.prototype),\n' + ' className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),\n' + ' nonEnum = nonEnumProps[className];\n' + - ' <% for (var index = 0; index < 7; index++) { %>\n' + + ' <% for (var index = 0; index < 7; index++) { %>\n' + " key = '<%= shadowedProps[index] %>';\n" + ' if ((!(isProto && nonEnum[key]) && hasOwnProperty.call(object, key))<%' + ' if (!useHas) { %> || (!nonEnum[key] && object[key] !== objectProto[key])<% }' + ' %>) {\n' + ' <%= loop %>;\n' + ' }' + - ' <% } %>\n' + + ' <% } %>\n' + '}' + '<% } %>\n' + - 'return result' + 'return result;' ); /*--------------------------------------------------------------------------*/ @@ -1925,7 +1931,7 @@ var shimKeys = createIterator({ 'args': 'object', 'init': '[]', - 'top': 'if (!(objectTypes[typeof object])) return result', + 'top': '', 'loop': 'result.push(key)', 'useHas': true }); @@ -2350,7 +2356,7 @@ 'args': 'object, callback, thisArg', 'init': 'object', 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)", - 'loop': 'if (callback(object[key], key, object) === false) return result', + 'loop': 'if (callback(object[key], key, object) === false) {\n return result;\n }', 'useHas': false });