From 4d10584233af1e83a5aea100775c6975ec91aedd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 30 Dec 2013 23:58:56 -0600 Subject: [PATCH] Beef up `_.parseInt` support and add `trim` internally. --- dist/lodash.compat.js | 65 ++++++--- dist/lodash.compat.min.js | 105 +++++++------- dist/lodash.js | 63 +++++--- dist/lodash.min.js | 102 ++++++------- dist/lodash.underscore.js | 12 +- doc/README.md | 292 +++++++++++++++++++------------------- lodash.js | 66 ++++++--- test/test.js | 66 ++++++--- 8 files changed, 448 insertions(+), 323 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 1a913ba21..401a6e154 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -31,7 +31,7 @@ /** Used as the max size of the `arrayPool` and `objectPool` */ var maxPoolSize = 40; - /** Used to detect and test whitespace */ + /** Used to detect and test whitespace (unicode 6.3.0) */ var whitespace = ( // whitespace ' \t\x0B\f\xA0\ufeff' + @@ -40,7 +40,7 @@ '\n\r\u2028\u2029' + // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' + '\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' ); /** Used to match empty string literals in compiled template source */ @@ -48,6 +48,15 @@ reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + /** Used to match HTML entities and HTML characters */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g; + + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + /** * Used to match ES6 template delimiters * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals @@ -60,17 +69,8 @@ /** Used to detected named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; - /** Used to match template delimiters */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); + /** Used to detect hexadecimal string values */ + var reHexPrefix = /^0[xX]/; /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -586,7 +586,8 @@ nativeMax = Math.max, nativeMin = Math.min, nativeParseInt = context.parseInt, - nativeRandom = Math.random; + nativeRandom = Math.random, + nativeTrim = isNative(nativeTrim = stringProto.trim) && nativeTrim; /** Used to lookup a built-in constructor by [[Class]] */ var ctorByClass = {}; @@ -1131,7 +1132,7 @@ function baseCreate(prototype, properties) { return isObject(prototype) ? nativeCreate(prototype) : {}; } - // fallback for browsers without `Object.create` + // fallback for environments without `Object.create` if (!nativeCreate) { baseCreate = (function() { function Object() {} @@ -1894,6 +1895,32 @@ return typeof result == 'undefined' || hasOwnProperty.call(value, result); } + /** + * Removes leading and trailing whitespace from a given string. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function trim(string) { + return string == null ? '' : nativeTrim.call(string); + } + // fallback for environments without a proper `String#trim` + if (!nativeTrim || nativeTrim.call(whitespace)) { + trim = function(string) { + var start = -1, + end = string ? string.length : 0; + + if (!end || string == null) { + return ''; + } + string = String(string); + while (whitespace.indexOf(string.charAt(++start)) > -1) { } + while (whitespace.indexOf(string.charAt(--end)) > -1) { } + return string.slice(start, end + 1); + }; + } + /** * Used by `unescape` to convert HTML entities to characters. * @@ -1927,7 +1954,7 @@ return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == argsClass || false; } - // fallback for browsers that can't detect `arguments` objects by [[Class]] + // fallback for environments that can't detect `arguments` objects by [[Class]] if (!support.argsClass) { isArguments = function(value) { return value && typeof value == 'object' && typeof value.length == 'number' && @@ -6461,8 +6488,10 @@ * // => 8 */ var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); + // Chrome fails to trim leading whitespace characters. + // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`. + value = trim(value); + return nativeParseInt(value, +radix || (reHexPrefix.test(value) ? 16 : 10)); }; /** diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 5d4cbb3e6..8e19d2331 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -6,56 +6,57 @@ ;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(nr?0:r);++e=w&&o===t,l=[]; -if(f){var c=i(e);c?(o=r,e=c):f=false}for(;++uo(e,c)&&l.push(c);return f&&g(e),l}function lt(n,t,r){var e=-1,u=n,o=n?n.length:0;if(t=t&&typeof r=="undefined"?t:ot(t,r,3),typeof o=="number")for(Qr.unindexedChars&&Tt(u)&&(u=u.split(""));++e=w&&a===t,h=u||p?l():c;for(p&&(h=i(h),a=r);++oa(h,y))&&((u||p)&&h.push(y),c.push(v))}return p?(s(h.g),g(h)):u&&s(h),c}function vt(n){return function(t,r,u){var o={};if(r=e.createCallback(r,u,3),Yr(t)){u=-1;for(var a=t.length;++uu;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;")+"}")(ot,V,br,Nr,xt,_r,rt,Jr,Q,wr,Cr) -}function dt(n){return nt[n]}function bt(){var n=(n=e.indexOf)===Ht?t:n;return n}function _t(n){return typeof n=="function"&&kr.test(Ir.call(n))}function wt(n){var t,r;return!n||Cr.call(n)!=H||(t=n.constructor,At(t)&&!(t instanceof t))||!Qr.argsClass&&xt(n)||!Qr.nodeClass&&p(n)?false:Qr.ownLast?(te(n,function(n,t,e){return r=Nr.call(e,t),false}),false!==r):(te(n,function(n,t){r=t}),typeof r=="undefined"||Nr.call(n,r))}function jt(n){return tt[n]}function xt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Cr.call(n)==W||false -}function Ct(n,t,r){var e=arguments,u=0,o=typeof r=="number"?2:e.length;if(3=e)return false;if(typeof n=="string"||!Yr(n)&&Tt(n))return Fr?Fr.call(n,t,r):-1r?Mr(0,e+r):r)||0,-1a&&(a=f)}}else t=null==t&&Tt(n)?u:e.createCallback(t,r,3),lt(n,function(n,r,e){r=t(n,r,e),r>o&&(o=r,a=n)});return a}function Kt(n,t,r,u){var o=3>arguments.length;if(t=e.createCallback(t,u,4),Yr(n)){var a=-1,i=n.length;for(o&&i&&(r=n[++a]);++aarguments.length;return t=e.createCallback(t,u,4),Lt(n,function(n,e,u){r=o?(o=false,n):t(r,n,e,u)}),r}function Vt(n){var t=-1,r=n?n.length:0,e=fr(typeof r=="number"?r:0);return Bt(n,function(n){var r=gt(0,++t);e[t]=e[r],e[r]=n}),e}function Ut(n,t,r){var u;if(t=e.createCallback(t,r,3),Yr(n)){r=-1;for(var o=n.length;++re?Mr(0,u+e):e||0}else if(e)return e=Qt(n,r),n[e]===r?e:-1;return t(n,r,e)}function Jt(n,t,r){if(typeof t!="number"&&null!=t){var u=0,o=-1,a=n?n.length:0;for(t=e.createCallback(t,r,3);++o>>1,r(n[u])r?0:r);++t=y;m?(u&&(u=Er(u)),c=a,o=n.apply(i,e)):u||(u=Pr(v,y))}return m&&f?f=Er(f):f||t===p||(f=Pr(h,t)),r&&(m=true,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function rr(n){return n}function er(n){n||(n={});var t=ne(n),r=t[0],e=n[r];return 1!=t.length||e!==e||Nt(e)?function(r){for(var e=t.length,u=false;e--&&(u=pt(r[t[e]],n[t[e]],null,true)););return u}:function(n){return n=n[r],e===n&&(0!==e||1/e==1/n)}}function ur(n,t,r){var u=true,o=t&&St(t);t&&(r||o.length)||(null==r&&(r=t),a=m,t=n,n=e,o=St(t)),false===r?u=false:Nt(r)&&"chain"in r&&(u=r.chain); -var a=n,i=At(a);Bt(o,function(r){var e=n[r]=t[r];i&&(a.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,o=[r];if(Rr.apply(o,arguments),o=e.apply(n,o),u||t){if(r===o&&Nt(o))return this;o=new a(o),o.__chain__=t}return o})})}function or(){}function ar(n){return function(t){return t[n]}}function ir(){return this.__wrapped__}n=n?ft.defaults(ut.Object(),n,ft.pick(ut,B)):ut;var fr=n.Array,lr=n.Boolean,cr=n.Date,pr=n.Function,sr=n.Math,gr=n.Number,hr=n.Object,vr=n.RegExp,yr=n.String,mr=n.TypeError,dr=fr.prototype,br=n.Error.prototype,_r=hr.prototype,wr=yr.prototype,jr=(jr=n.window)&&jr.document,xr=n._,Cr=_r.toString,kr=vr("^"+yr(Cr).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Or=sr.ceil,Er=n.clearTimeout,Sr=sr.floor,Ir=pr.prototype.toString,Ar=_t(Ar=hr.getPrototypeOf)&&Ar,Nr=_r.hasOwnProperty,Rr=dr.push,Tr=_r.propertyIsEnumerable,Pr=n.setTimeout,Dr=dr.splice,$r=dr.unshift,qr=function(){try{var n={},t=_t(t=hr.defineProperty)&&t,r=t(n,n,n)&&t -}catch(e){}return r}(),Fr=_t(Fr=wr.contains)&&Fr,Br=_t(Br=hr.create)&&Br,Lr=_t(Lr=fr.isArray)&&Lr,Wr=n.isFinite,zr=n.isNaN,Kr=_t(Kr=hr.keys)&&Kr,Mr=sr.max,Vr=sr.min,Ur=n.parseInt,Gr=sr.random,Hr={};Hr[z]=fr,Hr[K]=lr,Hr[M]=cr,Hr[U]=pr,Hr[H]=hr,Hr[G]=gr,Hr[J]=vr,Hr[Q]=yr;var Jr={};Jr[z]=Jr[M]=Jr[G]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Jr[K]=Jr[Q]={constructor:true,toString:true,valueOf:true},Jr[V]=Jr[U]=Jr[J]={constructor:true,toString:true},Jr[H]={constructor:true},function(){for(var n=L.length;n--;){var t,r=L[n]; -for(t in Jr)Nr.call(Jr,t)&&!Nr.call(Jr[t],r)&&(Jr[t][r]=false)}}(),m.prototype=e.prototype;var Qr=e.support={};!function(){var t=function(){this.x=1},r={0:1,length:1},e=[];t.prototype={valueOf:1,y:1};for(var u in new t)e.push(u);for(u in arguments);Qr.argsClass=Cr.call(arguments)==W,Qr.argsObject=arguments.constructor==hr&&!(arguments instanceof fr),Qr.enumErrorProps=Tr.call(br,"message")||Tr.call(br,"name"),Qr.enumPrototypes=Tr.call(t,"prototype"),Qr.funcDecomp=!_t(n.WinRTError)&&q.test(v),Qr.funcNames=typeof pr.name=="string",Qr.nonEnumArgs=0!=u,Qr.nonEnumShadows=!/valueOf/.test(e),Qr.ownLast="x"!=e[0],Qr.spliceObjects=(Dr.call(r,0,1),!r[0]),Qr.unindexedChars="xx"!="x"[0]+hr("x")[0]; -try{Qr.dom=11===jr.createDocumentFragment().nodeType}catch(o){Qr.dom=false}try{Qr.nodeClass=!(Cr.call(undefined)==H&&!({toString:0}+""))}catch(a){Qr.nodeClass=true}}(1),e.templateSettings={escape:A,evaluate:N,interpolate:R,variable:"",imports:{_:e}},Br||(et=function(){function t(){}return function(r){if(Nt(r)){t.prototype=r;var e=new t;t.prototype=null}return e||n.Object()}}());var Xr=qr?function(n,t){Z.value=t,qr(n,"__bindData__",Z)}:or;Qr.argsClass||(xt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Nr.call(n,"callee")&&!Tr.call(n,"callee")||false -});var Yr=Lr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Cr.call(n)==z||false},Zr=mt({a:"p",b:"[]",e:"",c:"s.push(l)",f:true}),ne=Kr?function(n){return Nt(n)?Qr.enumPrototypes&&typeof n=="function"||Qr.nonEnumArgs&&n.length&&xt(n)?Zr(n):Kr(n):[]}:Zr,te=mt({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});Qr.dom||(It=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!re(n)||false}),At(/x/)&&(At=function(n){return typeof n=="function"&&Cr.call(n)==U -});var re=Ar?function(n){if(!n||Cr.call(n)!=H||!Qr.argsClass&&xt(n))return false;var t=n.valueOf,r=_t(t)&&(r=Ar(t))&&Ar(r);return r?n==r||Ar(n)==r:wt(n)}:wt,ee=vt(function(n,t,r){Nr.call(n,r)?n[r]++:n[r]=1}),ue=vt(function(n,t,r){(Nr.call(n,r)?n[r]:n[r]=[]).push(t)}),oe=vt(function(n,t,r){n[r]=t}),ae=Wt,ie=_t(ie=cr.now)&&ie||function(){return(new cr).getTime()},fe=8==Ur(x+"08")?Ur:function(n,t){return Ur(Tt(n)?n.replace(D,""):n,t||0)};return e.after=function(n,t){if(!At(t))throw new mr;return function(){return 1>--n?t.apply(this,arguments):void 0 -}},e.assign=Ct,e.at=function(n){var t=arguments,r=-1,e=ct(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=fr(t);for(Qr.unindexedChars&&Tt(n)&&(n=n.split(""));++r=w&&i(e?n[e]:c)))}var f=n[0],h=-1,v=f?f.length:0,y=[];n:for(;++h(m?r(m,p):a(c,p))){for(e=u,(m||c).push(p);--e;)if(m=o[e],0>(m?r(m,p):a(n[e],p)))continue n;y.push(p)}}for(;u--;)(m=o[u])&&g(m);return s(o),s(c),y},e.invert=function(n,t){for(var r=-1,e=ne(n),u=e.length,o={};++rr?Mr(0,e+r):Vr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},e.mixin=ur,e.noConflict=function(){return n._=xr,this},e.noop=or,e.now=ie,e.parseInt=fe,e.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Gr(),Vr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):gt(n,t) -},e.reduce=Kt,e.reduceRight=Mt,e.result=function(n,t){if(n){var r=n[t];return At(r)?n[t]():r}},e.runInContext=v,e.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ne(n).length},e.some=Ut,e.sortedIndex=Qt,e.template=function(n,t,r){var u=e.templateSettings;n=yr(n||""),r=kt({},r,u);var o,a=kt({},r.imports,u.imports),u=ne(a),a=Pt(a),i=0,l=r.interpolate||$,c="__p+='",l=vr((r.escape||$).source+"|"+l.source+"|"+(l===R?E:$).source+"|"+(r.evaluate||$).source+"|$","g");n.replace(l,function(t,r,e,u,a,l){return e||(e=u),c+=n.slice(i,l).replace(F,f),r&&(c+="'+__e("+r+")+'"),a&&(o=true,c+="';"+a+";\n__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),i=l+t.length,t -}),c+="';",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(o?c.replace(C,""):c).replace(k,"$1").replace(O,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var p=pr(u,"return "+c).apply(y,a)}catch(s){throw s.source=c,s}return t?p(t):(p.source=c,p)},e.unescape=function(n){return null==n?"":(n=yr(n),0>n.indexOf(";")?n:n.replace(T,jt))},e.uniqueId=function(n){var t=++b; -return yr(null==n?"":n)+t},e.all=$t,e.any=Ut,e.detect=Ft,e.findWhere=Ft,e.foldl=Kt,e.foldr=Mt,e.include=Dt,e.inject=Kt,ur(function(){var n={};return Ot(e,function(t,r){e.prototype[r]||(n[r]=t)}),n}(),false),e.first=Gt,e.last=function(n,t,r){var u=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=o;for(t=e.createCallback(t,r,3);a--&&t(n[a],a,n);)u++}else if(u=t,null==u||r)return n?n[o-1]:y;return h(n,Mr(0,o-u))},e.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Pt(n):Qr.unindexedChars&&Tt(n)&&(n=n.split("")),null==t||r?n?n[gt(0,n.length-1)]:y:(n=Vt(n),n.length=Vr(Mr(0,t),n.length),n) -},e.take=Gt,e.head=Gt,Ot(e,function(n,t){var r="sample"!==t;e.prototype[t]||(e.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 m(o,u):o})}),e.VERSION="2.4.1",e.prototype.chain=function(){return this.__chain__=true,this},e.prototype.toString=function(){return yr(this.__wrapped__)},e.prototype.value=ir,e.prototype.valueOf=ir,lt(["join","pop","shift"],function(n){var t=dr[n];e.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); -return n?new m(r,n):r}}),lt(["push","reverse","sort","unshift"],function(n){var t=dr[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),lt(["concat","slice","splice"],function(n){var t=dr[n];e.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Qr.spliceObjects||lt(["pop","shift","splice"],function(n){var t=dr[n],r="splice"==n;e.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 m(u,n):u -}}),e}var y,m=[],d=[],b=0,_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,E=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,S=/\w*$/,I=/^\s*function[ \n\r\t]+\w/,A=/<%-([\s\S]+?)%>/g,N=/<%([\s\S]+?)%>/g,R=/<%=([\s\S]+?)%>/g,T=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,D=RegExp("^["+x+"]*0+(?=.$)"),$=/($^)/,q=/\bthis\b/,F=/['\n\r\t\u2028\u2029\\]/g,B="Array Boolean Date Error Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),W="[object Arguments]",z="[object Array]",K="[object Boolean]",M="[object Date]",V="[object Error]",U="[object Function]",G="[object Number]",H="[object Object]",J="[object RegExp]",Q="[object String]",X={}; -X[U]=false,X[W]=X[z]=X[K]=X[M]=X[G]=X[H]=X[J]=X[Q]=true;var Y={leading:false,maxWait:0,trailing:false},Z={configurable:false,enumerable:false,value:null,writable:false},nt={"&":"&","<":"<",">":">",'"':""","'":"'"},tt={"&":"&","<":"<",">":">",""":'"',"'":"'"},rt={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},et={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ut=rt[typeof window]&&window||this,ot=rt[typeof exports]&&exports&&!exports.nodeType&&exports,at=rt[typeof global]&&global; +var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++e=w&&o===t,l=[]; +if(f){var c=i(e);c?(o=r,e=c):f=false}for(;++uo(e,c)&&l.push(c);return f&&g(e),l}function lt(n,t,r){var e=-1,u=n,o=n?n.length:0;if(t=t&&typeof r=="undefined"?t:ot(t,r,3),typeof o=="number")for(Yr.unindexedChars&&Rt(u)&&(u=u.split(""));++e=w&&a===t,h=u||p?l():c;for(p&&(h=i(h),a=r);++oa(h,y))&&((u||p)&&h.push(y),c.push(v))}return p?(s(h.g),g(h)):u&&s(h),c}function vt(n){return function(t,r,u){var o={};if(r=e.createCallback(r,u,3),ne(t)){u=-1;for(var a=t.length;++uu;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;")+"}")(ot,V,_r,Tr,Ct,wr,rt,Qr,J,jr,kr) +}function dt(n){return nt[n]}function bt(){var n=(n=e.indexOf)===Ht?t:n;return n}function _t(n){return typeof n=="function"&&Or.test(Ir.call(n))}function wt(n){var t,r;return!n||kr.call(n)!=G||(t=n.constructor,Nt(t)&&!(t instanceof t))||!Yr.argsClass&&Ct(n)||!Yr.nodeClass&&p(n)?false:Yr.ownLast?(ee(n,function(n,t,e){return r=Tr.call(e,t),false}),false!==r):(ee(n,function(n,t){r=t}),typeof r=="undefined"||Tr.call(n,r))}function jt(n){return null==n?"":Hr.call(n)}function xt(n){return tt[n]}function Ct(n){return n&&typeof n=="object"&&typeof n.length=="number"&&kr.call(n)==W||false +}function kt(n,t,r){var e=arguments,u=0,o=typeof r=="number"?2:e.length;if(3=e)return false;if(typeof n=="string"||!ne(n)&&Rt(n))return Br?Br.call(n,t,r):-1r?Vr(0,e+r):r)||0,-1a&&(a=f)}}else t=null==t&&Rt(n)?u:e.createCallback(t,r,3),lt(n,function(n,r,e){r=t(n,r,e),r>o&&(o=r,a=n)});return a}function Mt(n,t,r,u){var o=3>arguments.length;if(t=e.createCallback(t,u,4),ne(n)){var a=-1,i=n.length;for(o&&i&&(r=n[++a]);++aarguments.length;return t=e.createCallback(t,u,4),Wt(n,function(n,e,u){r=o?(o=false,n):t(r,n,e,u)}),r}function Ut(n){var t=-1,r=n?n.length:0,e=lr(typeof r=="number"?r:0);return Lt(n,function(n){var r=gt(0,++t);e[t]=e[r],e[r]=n}),e}function Xt(n,t,r){var u;if(t=e.createCallback(t,r,3),ne(n)){r=-1;for(var o=n.length;++re?Vr(0,u+e):e||0}else if(e)return e=Qt(n,r),n[e]===r?e:-1;return t(n,r,e)}function Jt(n,t,r){if(typeof t!="number"&&null!=t){var u=0,o=-1,a=n?n.length:0;for(t=e.createCallback(t,r,3);++o>>1,r(n[u])r?0:r);++t=y;m?(u&&(u=Sr(u)),c=a,o=n.apply(i,e)):u||(u=Dr(v,y))}return m&&f?f=Sr(f):f||t===p||(f=Dr(h,t)),r&&(m=true,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function er(n){return n}function ur(n){n||(n={});var t=re(n),r=t[0],e=n[r];return 1!=t.length||e!==e||Tt(e)?function(r){for(var e=t.length,u=false;e--&&(u=pt(r[t[e]],n[t[e]],null,true)););return u}:function(n){return n=n[r],e===n&&(0!==e||1/e==1/n)}}function or(n,t,r){var u=true,o=t&&At(t);t&&(r||o.length)||(null==r&&(r=t),a=m,t=n,n=e,o=At(t)),false===r?u=false:Tt(r)&&"chain"in r&&(u=r.chain); +var a=n,i=Nt(a);Lt(o,function(r){var e=n[r]=t[r];i&&(a.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,o=[r];if(Pr.apply(o,arguments),o=e.apply(n,o),u||t){if(r===o&&Tt(o))return this;o=new a(o),o.__chain__=t}return o})})}function ar(){}function ir(n){return function(t){return t[n]}}function fr(){return this.__wrapped__}n=n?ft.defaults(ut.Object(),n,ft.pick(ut,B)):ut;var lr=n.Array,cr=n.Boolean,pr=n.Date,sr=n.Function,gr=n.Math,hr=n.Number,vr=n.Object,yr=n.RegExp,mr=n.String,dr=n.TypeError,br=lr.prototype,_r=n.Error.prototype,wr=vr.prototype,jr=mr.prototype,xr=(xr=n.window)&&xr.document,Cr=n._,kr=wr.toString,Or=yr("^"+mr(kr).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Er=gr.ceil,Sr=n.clearTimeout,Ar=gr.floor,Ir=sr.prototype.toString,Nr=_t(Nr=vr.getPrototypeOf)&&Nr,Tr=wr.hasOwnProperty,Pr=br.push,Rr=wr.propertyIsEnumerable,Dr=n.setTimeout,qr=br.splice,Fr=br.unshift,$r=function(){try{var n={},t=_t(t=vr.defineProperty)&&t,r=t(n,n,n)&&t +}catch(e){}return r}(),Br=_t(Br=jr.contains)&&Br,Lr=_t(Lr=vr.create)&&Lr,Wr=_t(Wr=lr.isArray)&&Wr,zr=n.isFinite,Kr=n.isNaN,Mr=_t(Mr=vr.keys)&&Mr,Vr=gr.max,Ur=gr.min,Xr=n.parseInt,Gr=gr.random,Hr=_t(Hr=jr.trim)&&Hr,Jr={};Jr[z]=lr,Jr[K]=cr,Jr[M]=pr,Jr[U]=sr,Jr[G]=vr,Jr[X]=hr,Jr[H]=yr,Jr[J]=mr;var Qr={};Qr[z]=Qr[M]=Qr[X]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Qr[K]=Qr[J]={constructor:true,toString:true,valueOf:true},Qr[V]=Qr[U]=Qr[H]={constructor:true,toString:true},Qr[G]={constructor:true},function(){for(var n=L.length;n--;){var t,r=L[n]; +for(t in Qr)Tr.call(Qr,t)&&!Tr.call(Qr[t],r)&&(Qr[t][r]=false)}}(),m.prototype=e.prototype;var Yr=e.support={};!function(){var t=function(){this.x=1},r={0:1,length:1},e=[];t.prototype={valueOf:1,y:1};for(var u in new t)e.push(u);for(u in arguments);Yr.argsClass=kr.call(arguments)==W,Yr.argsObject=arguments.constructor==vr&&!(arguments instanceof lr),Yr.enumErrorProps=Rr.call(_r,"message")||Rr.call(_r,"name"),Yr.enumPrototypes=Rr.call(t,"prototype"),Yr.funcDecomp=!_t(n.WinRTError)&&F.test(v),Yr.funcNames=typeof sr.name=="string",Yr.nonEnumArgs=0!=u,Yr.nonEnumShadows=!/valueOf/.test(e),Yr.ownLast="x"!=e[0],Yr.spliceObjects=(qr.call(r,0,1),!r[0]),Yr.unindexedChars="xx"!="x"[0]+vr("x")[0]; +try{Yr.dom=11===xr.createDocumentFragment().nodeType}catch(o){Yr.dom=false}try{Yr.nodeClass=!(kr.call(undefined)==G&&!({toString:0}+""))}catch(a){Yr.nodeClass=true}}(1),e.templateSettings={escape:A,evaluate:I,interpolate:N,variable:"",imports:{_:e}},Lr||(et=function(){function t(){}return function(r){if(Tt(r)){t.prototype=r;var e=new t;t.prototype=null}return e||n.Object()}}());var Zr=$r?function(n,t){Z.value=t,$r(n,"__bindData__",Z)}:ar;(!Hr||Hr.call(x))&&(jt=function(n){var t=-1,r=n?n.length:0;if(!r||null==n)return"";for(n=mr(n);-1--n?t.apply(this,arguments):void 0}},e.assign=kt,e.at=function(n){var t=arguments,r=-1,e=ct(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=lr(t);for(Yr.unindexedChars&&Rt(n)&&(n=n.split(""));++r=w&&i(e?n[e]:c)))}var f=n[0],h=-1,v=f?f.length:0,y=[];n:for(;++h(m?r(m,p):a(c,p))){for(e=u,(m||c).push(p);--e;)if(m=o[e],0>(m?r(m,p):a(n[e],p)))continue n;y.push(p) +}}for(;u--;)(m=o[u])&&g(m);return s(o),s(c),y},e.invert=function(n,t){for(var r=-1,e=re(n),u=e.length,o={};++rr?Vr(0,e+r):Ur(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},e.mixin=or,e.noConflict=function(){return n._=Cr,this},e.noop=ar,e.now=le,e.parseInt=ce,e.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Gr(),Ur(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):gt(n,t) +},e.reduce=Mt,e.reduceRight=Vt,e.result=function(n,t){if(n){var r=n[t];return Nt(r)?n[t]():r}},e.runInContext=v,e.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:re(n).length},e.some=Xt,e.sortedIndex=Qt,e.template=function(n,t,r){var u=e.templateSettings;n=mr(n||""),r=Ot({},r,u);var o,a=Ot({},r.imports,u.imports),u=re(a),a=Dt(a),i=0,l=r.interpolate||q,c="__p+='",l=yr((r.escape||q).source+"|"+l.source+"|"+(l===N?T:q).source+"|"+(r.evaluate||q).source+"|$","g");n.replace(l,function(t,r,e,u,a,l){return e||(e=u),c+=n.slice(i,l).replace($,f),r&&(c+="'+__e("+r+")+'"),a&&(o=true,c+="';"+a+";\n__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),i=l+t.length,t +}),c+="';",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(o?c.replace(C,""):c).replace(k,"$1").replace(O,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var p=sr(u,"return "+c).apply(y,a)}catch(s){throw s.source=c,s}return t?p(t):(p.source=c,p)},e.unescape=function(n){return null==n?"":(n=mr(n),0>n.indexOf(";")?n:n.replace(E,xt))},e.uniqueId=function(n){var t=++b; +return mr(null==n?"":n)+t},e.all=Ft,e.any=Xt,e.detect=Bt,e.findWhere=Bt,e.foldl=Mt,e.foldr=Vt,e.include=qt,e.inject=Mt,or(function(){var n={};return Et(e,function(t,r){e.prototype[r]||(n[r]=t)}),n}(),false),e.first=Gt,e.last=function(n,t,r){var u=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=o;for(t=e.createCallback(t,r,3);a--&&t(n[a],a,n);)u++}else if(u=t,null==u||r)return n?n[o-1]:y;return h(n,Vr(0,o-u))},e.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Dt(n):Yr.unindexedChars&&Rt(n)&&(n=n.split("")),null==t||r?n?n[gt(0,n.length-1)]:y:(n=Ut(n),n.length=Ur(Vr(0,t),n.length),n) +},e.take=Gt,e.head=Gt,Et(e,function(n,t){var r="sample"!==t;e.prototype[t]||(e.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 m(o,u):o})}),e.VERSION="2.4.1",e.prototype.chain=function(){return this.__chain__=true,this},e.prototype.toString=function(){return mr(this.__wrapped__)},e.prototype.value=fr,e.prototype.valueOf=fr,lt(["join","pop","shift"],function(n){var t=br[n];e.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); +return n?new m(r,n):r}}),lt(["push","reverse","sort","unshift"],function(n){var t=br[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),lt(["concat","slice","splice"],function(n){var t=br[n];e.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Yr.spliceObjects||lt(["pop","shift","splice"],function(n){var t=br[n],r="splice"==n;e.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 m(u,n):u +}}),e}var y,m=[],d=[],b=0,_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,E=/&(?:amp|lt|gt|quot|#39);/g,S=/[&<>"']/g,A=/<%-([\s\S]+?)%>/g,I=/<%([\s\S]+?)%>/g,N=/<%=([\s\S]+?)%>/g,T=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,P=/\w*$/,R=/^\s*function[ \n\r\t]+\w/,D=/^0[xX]/,q=/($^)/,F=/\bthis\b/,$=/['\n\r\t\u2028\u2029\\]/g,B="Array Boolean Date Error Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),W="[object Arguments]",z="[object Array]",K="[object Boolean]",M="[object Date]",V="[object Error]",U="[object Function]",X="[object Number]",G="[object Object]",H="[object RegExp]",J="[object String]",Q={}; +Q[U]=false,Q[W]=Q[z]=Q[K]=Q[M]=Q[X]=Q[G]=Q[H]=Q[J]=true;var Y={leading:false,maxWait:0,trailing:false},Z={configurable:false,enumerable:false,value:null,writable:false},nt={"&":"&","<":"<",">":">",'"':""","'":"'"},tt={"&":"&","<":"<",">":">",""":'"',"'":"'"},rt={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},et={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ut=rt[typeof window]&&window||this,ot=rt[typeof exports]&&exports&&!exports.nodeType&&exports,at=rt[typeof global]&&global; !at||at.global!==at&&at.window!==at||(ut=at);var it=(at=rt[typeof module]&&module&&!module.nodeType&&module)&&at.exports===ot&&ot,ft=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ut._=ft, define(function(){return ft})):ot&&at?it?(at.exports=ft)._=ft:ot._=ft:ut._=ft}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index d4a8c879e..369715084 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -28,7 +28,7 @@ /** Used as the max size of the `arrayPool` and `objectPool` */ var maxPoolSize = 40; - /** Used to detect and test whitespace */ + /** Used to detect and test whitespace (unicode 6.3.0) */ var whitespace = ( // whitespace ' \t\x0B\f\xA0\ufeff' + @@ -37,7 +37,7 @@ '\n\r\u2028\u2029' + // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' + '\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' ); /** Used to match empty string literals in compiled template source */ @@ -45,6 +45,15 @@ reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + /** Used to match HTML entities and HTML characters */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g; + + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + /** * Used to match ES6 template delimiters * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals @@ -57,17 +66,8 @@ /** Used to detected named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; - /** Used to match template delimiters */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); + /** Used to detect hexadecimal string values */ + var reHexPrefix = /^0[xX]/; /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -560,7 +560,8 @@ nativeMax = Math.max, nativeMin = Math.min, nativeParseInt = context.parseInt, - nativeRandom = Math.random; + nativeRandom = Math.random, + nativeTrim = isNative(nativeTrim = stringProto.trim) && nativeTrim; /** Used to lookup a built-in constructor by [[Class]] */ var ctorByClass = {}; @@ -904,7 +905,7 @@ function baseCreate(prototype, properties) { return isObject(prototype) ? nativeCreate(prototype) : {}; } - // fallback for browsers without `Object.create` + // fallback for environments without `Object.create` if (!nativeCreate) { baseCreate = (function() { function Object() {} @@ -1593,6 +1594,32 @@ return typeof result == 'undefined' || hasOwnProperty.call(value, result); } + /** + * Removes leading and trailing whitespace from a given string. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function trim(string) { + return string == null ? '' : nativeTrim.call(string); + } + // fallback for environments without a proper `String#trim` + if (!nativeTrim || nativeTrim.call(whitespace)) { + trim = function(string) { + var start = -1, + end = string ? string.length : 0; + + if (!end || string == null) { + return ''; + } + string = String(string); + while (whitespace.indexOf(string.charAt(++start)) > -1) { } + while (whitespace.indexOf(string.charAt(--end)) > -1) { } + return string.slice(start, end + 1); + }; + } + /** * Used by `unescape` to convert HTML entities to characters. * @@ -6142,8 +6169,10 @@ * // => 8 */ var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); + // Chrome fails to trim leading whitespace characters. + // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`. + value = trim(value); + return nativeParseInt(value, +radix || (reHexPrefix.test(value) ? 16 : 10)); }; /** diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 7ff353f63..d250b91e7 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,54 +3,54 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne?0:e);++r=_&&o===t,l=[]; -if(f){var c=a(r);c?(o=e,r=c):f=false}for(;++uo(r,c)&&l.push(c);return f&&s(r),l}function ft(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r=_&&i===t,v=u||h?l():c;for(h&&(v=a(v),i=e);++oi(v,y))&&((u||h)&&v.push(y),c.push(g)) -}return h?(p(v.g),s(v)):u&&p(v),c}function ht(n){return function(t,e,r){var u={};e=m.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r=r)return false;if(typeof n=="string"||!Ge(n)&&Rt(n))return Ae?Ae.call(n,t,e):-1e?We(0,r+e):e)||0,-1o&&(o=a)}}else t=null==t&&Rt(n)?u:m.createCallback(t,e,3),Ft(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,o=n)});return o}function zt(n,t,e,r){var u=3>arguments.length;t=m.createCallback(t,r,4);var o=-1,i=n?n.length:0;if(typeof i=="number")for(u&&i&&(e=n[++o]);++oarguments.length;return t=m.createCallback(t,r,4),Bt(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) -}),e}function Kt(n){var t=-1,e=n?n.length:0,r=oe(typeof e=="number"?e:0);return Ft(n,function(n){var e=pt(0,++t);r[t]=r[e],r[e]=n}),r}function Lt(n,t,e){var r;t=m.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++er?We(0,u+r):r||0}else if(r)return r=Gt(n,e),n[r]===e?r:-1;return t(n,e,r)}function Ut(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=m.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t=g;m?(i&&(i=ke(i)),s=f,a=n.apply(l,o)):i||(i=Ie(r,g))}return m&&c?c=ke(c):c||t===h||(c=Ie(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Zt(n){return n}function ne(n){n||(n={});var t=He(n),e=t[0],r=n[e]; -return 1!=t.length||r!==r||Nt(r)?function(e){for(var r=t.length,u=false;r--&&(u=lt(e[t[r]],n[t[r]],null,true)););return u}:function(n){return n=n[e],r===n&&(0!==r||1/r==1/n)}}function te(n,t,e){var r=true,u=t&&Ct(t);t&&(e||u.length)||(null==e&&(e=t),o=w,t=n,n=m,u=Ct(t)),false===e?r=false:Nt(e)&&"chain"in e&&(r=e.chain);var o=n,i=Et(o);Ft(u,function(e){var u=n[e]=t[e];i&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,i=[e];if(Ne.apply(i,arguments),i=u.apply(n,i),r||t){if(e===i&&Nt(i))return this; -i=new o(i),i.__chain__=t}return i})})}function ee(){}function re(n){return function(t){return t[n]}}function ue(){return this.__wrapped__}n=n?ot.defaults(tt.Object(),n,ot.pick(tt,q)):tt;var oe=n.Array,ie=n.Boolean,ae=n.Date,fe=n.Function,le=n.Math,ce=n.Number,pe=n.Object,se=n.RegExp,he=n.String,ve=n.TypeError,ge=oe.prototype,ye=pe.prototype,me=he.prototype,be=(be=n.window)&&be.document,de=n._,_e=ye.toString,we=se("^"+he(_e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=le.ceil,ke=n.clearTimeout,xe=le.floor,Ce=fe.prototype.toString,Oe=mt(Oe=pe.getPrototypeOf)&&Oe,Ee=ye.hasOwnProperty,Ne=ge.push,Ie=n.setTimeout,Re=ge.splice,Se=ge.unshift,Te=function(){try{var n={},t=mt(t=pe.defineProperty)&&t,e=t(n,n,n)&&t -}catch(r){}return e}(),Ae=mt(Ae=me.contains)&&Ae,De=mt(De=pe.create)&&De,$e=mt($e=oe.isArray)&&$e,Fe=n.isFinite,Be=n.isNaN,qe=mt(qe=pe.keys)&&qe,We=le.max,ze=le.min,Pe=n.parseInt,Ke=le.random,Le={};Le[z]=oe,Le[P]=ie,Le[K]=ae,Le[L]=fe,Le[V]=pe,Le[M]=ce,Le[U]=se,Le[G]=he,w.prototype=m.prototype;var Me=m.support={};Me.funcDecomp=!mt(n.WinRTError)&&F.test(v),Me.funcNames=typeof fe.name=="string";try{Me.dom=11===be.createDocumentFragment().nodeType}catch(Ve){Me.dom=false}m.templateSettings={escape:I,evaluate:R,interpolate:S,variable:"",imports:{_:m}},De||(rt=function(){function t(){}return function(e){if(Nt(e)){t.prototype=e; -var r=new t;t.prototype=null}return r||n.Object()}}());var Ue=Te?function(n,t){Q.value=t,Te(n,"__bindData__",Q)}:ee,Ge=$e||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&_e.call(n)==z||false},He=qe?function(n){return Nt(n)?qe(n):[]}:y;Me.dom||(Ot=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!Je(n)||false});var Je=Oe?function(n){if(!n||_e.call(n)!=V)return false;var t=n.valueOf,e=mt(t)&&(e=Oe(t))&&Oe(e);return e?n==e||Oe(n)==e:bt(n)}:bt,Qe=ht(function(n,t,e){Ee.call(n,e)?n[e]++:n[e]=1 -}),Xe=ht(function(n,t,e){(Ee.call(n,e)?n[e]:n[e]=[]).push(t)}),Ye=ht(function(n,t,e){n[e]=t}),Ze=qt,nr=mt(nr=ae.now)&&nr||function(){return(new ae).getTime()},tr=8==Pe(j+"08")?Pe:function(n,t){return Pe(Rt(n)?n.replace(D,""):n,t||0)};return m.after=function(n,t){if(!Et(t))throw new ve;return function(){return 1>--n?t.apply(this,arguments):void 0}},m.assign=wt,m.at=function(n){for(var t=arguments,e=-1,r=ft(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=oe(t);++e=_&&a(r?n[r]:c)))}var f=n[0],v=-1,g=f?f.length:0,y=[];n:for(;++v(m?e(m,h):i(c,h))){for(r=u,(m||c).push(h);--r;)if(m=o[r],0>(m?e(m,h):i(n[r],h)))continue n;y.push(h) -}}for(;u--;)(m=o[u])&&s(m);return p(o),p(c),y},m.invert=function(n,t){for(var e=-1,r=He(n),u=r.length,o={};++ee?We(0,r+e):ze(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},m.mixin=te,m.noConflict=function(){return n._=de,this},m.noop=ee,m.now=nr,m.parseInt=tr,m.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(u&&typeof n=="boolean"?(e=n,n=1):typeof t=="boolean"&&(e=t,u=true)),r&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Ke(),ze(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):pt(n,t) -},m.reduce=zt,m.reduceRight=Pt,m.result=function(n,t){if(n){var e=n[t];return Et(e)?n[t]():e}},m.runInContext=v,m.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:He(n).length},m.some=Lt,m.sortedIndex=Gt,m.template=function(n,t,e){var r=m.templateSettings;n=he(n||""),e=jt({},e,r);var u,o=jt({},e.imports,r.imports),r=He(o),o=St(o),i=0,a=e.interpolate||$,l="__p+='",a=se((e.escape||$).source+"|"+a.source+"|"+(a===S?O:$).source+"|"+(e.evaluate||$).source+"|$","g");n.replace(a,function(t,e,r,o,a,c){return r||(r=o),l+=n.slice(i,c).replace(B,f),e&&(l+="'+__e("+e+")+'"),a&&(u=true,l+="';"+a+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t -}),l+="';",a=e=e.variable,a||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(k,""):l).replace(x,"$1").replace(C,"$1;"),l="function("+e+"){"+(a?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=fe(r,"return "+l).apply(g,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},m.unescape=function(n){return null==n?"":(n=he(n),0>n.indexOf(";")?n:n.replace(T,dt))},m.uniqueId=function(n){var t=++b; -return he(null==n?"":n)+t},m.all=At,m.any=Lt,m.detect=$t,m.findWhere=$t,m.foldl=zt,m.foldr=Pt,m.include=Tt,m.inject=zt,te(function(){var n={};return kt(m,function(t,e){m.prototype[e]||(n[e]=t)}),n}(),false),m.first=Mt,m.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=m.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:g;return h(n,We(0,u-r))},m.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=St(n)),null==t||e?n?n[pt(0,n.length-1)]:g:(n=Kt(n),n.length=ze(We(0,t),n.length),n) -},m.take=Mt,m.head=Mt,kt(m,function(n,t){var e="sample"!==t;m.prototype[t]||(m.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 w(o,u):o})}),m.VERSION="2.4.1",m.prototype.chain=function(){return this.__chain__=true,this},m.prototype.toString=function(){return he(this.__wrapped__)},m.prototype.value=ue,m.prototype.valueOf=ue,Ft(["join","pop","shift"],function(n){var t=ge[n];m.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); -return n?new w(e,n):e}}),Ft(["push","reverse","sort","unshift"],function(n){var t=ge[n];m.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ft(["concat","slice","splice"],function(n){var t=ge[n];m.prototype[n]=function(){return new w(t.apply(this.__wrapped__,arguments),this.__chain__)}}),m}var g,y=[],m=[],b=0,d=+new Date+"",_=75,w=40,j=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=/\b__p\+='';/g,x=/\b(__p\+=)''\+/g,C=/(__e\(.*?\)|\b__t\))\+'';/g,O=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,E=/\w*$/,N=/^\s*function[ \n\r\t]+\w/,I=/<%-([\s\S]+?)%>/g,R=/<%([\s\S]+?)%>/g,S=/<%=([\s\S]+?)%>/g,T=/&(?:amp|lt|gt|quot|#39);/g,A=/[&<>"']/g,D=RegExp("^["+j+"]*0+(?=.$)"),$=/($^)/,F=/\bthis\b/,B=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),W="[object Arguments]",z="[object Array]",P="[object Boolean]",K="[object Date]",L="[object Function]",M="[object Number]",V="[object Object]",U="[object RegExp]",G="[object String]",H={}; -H[L]=false,H[W]=H[z]=H[P]=H[K]=H[M]=H[V]=H[U]=H[G]=true;var J={leading:false,maxWait:0,trailing:false},Q={configurable:false,enumerable:false,value:null,writable:false},X={"&":"&","<":"<",">":">",'"':""","'":"'"},Y={"&":"&","<":"<",">":">",""":'"',"'":"'"},Z={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},nt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},tt=Z[typeof window]&&window||this,et=Z[typeof exports]&&exports&&!exports.nodeType&&exports,rt=Z[typeof global]&&global; -!rt||rt.global!==rt&&rt.window!==rt||(tt=rt);var ut=(rt=Z[typeof module]&&module&&!module.nodeType&&module)&&rt.exports===et&&et,ot=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(tt._=ot, define(function(){return ot})):et&&rt?ut?(rt.exports=ot)._=ot:et._=ot:tt._=ot}).call(this); \ No newline at end of file +;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(nr?0:r);++e=_&&o===t,l=[]; +if(f){var c=a(e);c?(o=r,e=c):f=false}for(;++uo(e,c)&&l.push(c);return f&&s(e),l}function ft(n,t,r,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e=_&&i===t,v=u||h?l():c;for(h&&(v=a(v),i=r);++oi(v,y))&&((u||h)&&v.push(y),c.push(g)) +}return h?(p(v.g),s(v)):u&&p(v),c}function ht(n){return function(t,r,e){var u={};r=m.createCallback(r,e,3),e=-1;var o=t?t.length:0;if(typeof o=="number")for(;++e=e)return false;if(typeof n=="string"||!Hr(n)&&St(n))return Dr?Dr.call(n,t,r):-1r?zr(0,e+r):r)||0,-1o&&(o=a)}}else t=null==t&&St(n)?u:m.createCallback(t,r,3),Bt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function Pt(n,t,r,e){var u=3>arguments.length;t=m.createCallback(t,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number")for(u&&i&&(r=n[++o]);++oarguments.length;return t=m.createCallback(t,e,4),qt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o) +}),r}function Lt(n){var t=-1,r=n?n.length:0,e=ir(typeof r=="number"?r:0);return Bt(n,function(n){var r=pt(0,++t);e[t]=e[r],e[r]=n}),e}function Mt(n,t,r){var e;t=m.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++re?zr(0,u+e):e||0}else if(e)return e=Gt(n,r),n[e]===r?e:-1;return t(n,r,e)}function Xt(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=m.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++t=g;m?(i&&(i=xr(i)),s=f,a=n.apply(l,o)):i||(i=Ir(e,g))}return m&&c?c=xr(c):c||t===h||(c=Ir(u,t)),r&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function nr(n){return n}function tr(n){n||(n={});var t=Jr(n),r=t[0],e=n[r]; +return 1!=t.length||e!==e||At(e)?function(r){for(var e=t.length,u=false;e--&&(u=lt(r[t[e]],n[t[e]],null,true)););return u}:function(n){return n=n[r],e===n&&(0!==e||1/e==1/n)}}function rr(n,t,r){var e=true,u=t&&Ot(t);t&&(r||u.length)||(null==r&&(r=t),o=w,t=n,n=m,u=Ot(t)),false===r?e=false:At(r)&&"chain"in r&&(e=r.chain);var o=n,i=Nt(o);Bt(u,function(r){var u=n[r]=t[r];i&&(o.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,i=[r];if(Ar.apply(i,arguments),i=u.apply(n,i),e||t){if(r===i&&At(i))return this; +i=new o(i),i.__chain__=t}return i})})}function er(){}function ur(n){return function(t){return t[n]}}function or(){return this.__wrapped__}n=n?ot.defaults(tt.Object(),n,ot.pick(tt,q)):tt;var ir=n.Array,ar=n.Boolean,fr=n.Date,lr=n.Function,cr=n.Math,pr=n.Number,sr=n.Object,hr=n.RegExp,vr=n.String,gr=n.TypeError,yr=ir.prototype,mr=sr.prototype,br=vr.prototype,dr=(dr=n.window)&&dr.document,_r=n._,wr=mr.toString,jr=hr("^"+vr(wr).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kr=cr.ceil,xr=n.clearTimeout,Cr=cr.floor,Or=lr.prototype.toString,Er=mt(Er=sr.getPrototypeOf)&&Er,Nr=mr.hasOwnProperty,Ar=yr.push,Ir=n.setTimeout,Sr=yr.splice,Tr=yr.unshift,Rr=function(){try{var n={},t=mt(t=sr.defineProperty)&&t,r=t(n,n,n)&&t +}catch(e){}return r}(),Dr=mt(Dr=br.contains)&&Dr,Fr=mt(Fr=sr.create)&&Fr,$r=mt($r=ir.isArray)&&$r,Br=n.isFinite,qr=n.isNaN,Wr=mt(Wr=sr.keys)&&Wr,zr=cr.max,Pr=cr.min,Kr=n.parseInt,Lr=cr.random,Mr=mt(Mr=br.trim)&&Mr,Vr={};Vr[z]=ir,Vr[P]=ar,Vr[K]=fr,Vr[L]=lr,Vr[V]=sr,Vr[M]=pr,Vr[U]=hr,Vr[X]=vr,w.prototype=m.prototype;var Ur=m.support={};Ur.funcDecomp=!mt(n.WinRTError)&&$.test(v),Ur.funcNames=typeof lr.name=="string";try{Ur.dom=11===dr.createDocumentFragment().nodeType}catch(Xr){Ur.dom=false}m.templateSettings={escape:N,evaluate:A,interpolate:I,variable:"",imports:{_:m}},Fr||(et=function(){function t(){}return function(r){if(At(r)){t.prototype=r; +var e=new t;t.prototype=null}return e||n.Object()}}());var Gr=Rr?function(n,t){J.value=t,Rr(n,"__bindData__",J)}:er;(!Mr||Mr.call(j))&&(dt=function(n){var t=-1,r=n?n.length:0;if(!r||null==n)return"";for(n=vr(n);-1--n?t.apply(this,arguments):void 0 +}},m.assign=jt,m.at=function(n){for(var t=arguments,r=-1,e=ft(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=ir(t);++r=_&&a(e?n[e]:c))) +}var f=n[0],v=-1,g=f?f.length:0,y=[];n:for(;++v(m?r(m,h):i(c,h))){for(e=u,(m||c).push(h);--e;)if(m=o[e],0>(m?r(m,h):i(n[e],h)))continue n;y.push(h)}}for(;u--;)(m=o[u])&&s(m);return p(o),p(c),y},m.invert=function(n,t){for(var r=-1,e=Jr(n),u=e.length,o={};++rr?zr(0,e+r):Pr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},m.mixin=rr,m.noConflict=function(){return n._=_r,this},m.noop=er,m.now=re,m.parseInt=ee,m.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Lr(),Pr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):pt(n,t) +},m.reduce=Pt,m.reduceRight=Kt,m.result=function(n,t){if(n){var r=n[t];return Nt(r)?n[t]():r}},m.runInContext=v,m.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Jr(n).length},m.some=Mt,m.sortedIndex=Gt,m.template=function(n,t,r){var e=m.templateSettings;n=vr(n||""),r=kt({},r,e);var u,o=kt({},r.imports,e.imports),e=Jr(o),o=Tt(o),i=0,a=r.interpolate||F,l="__p+='",a=hr((r.escape||F).source+"|"+a.source+"|"+(a===I?S:F).source+"|"+(r.evaluate||F).source+"|$","g");n.replace(a,function(t,r,e,o,a,c){return e||(e=o),l+=n.slice(i,c).replace(B,f),r&&(l+="'+__e("+r+")+'"),a&&(u=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t +}),l+="';",a=r=r.variable,a||(r="obj",l="with("+r+"){"+l+"}"),l=(u?l.replace(k,""):l).replace(x,"$1").replace(C,"$1;"),l="function("+r+"){"+(a?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=lr(e,"return "+l).apply(g,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},m.unescape=function(n){return null==n?"":(n=vr(n),0>n.indexOf(";")?n:n.replace(O,_t))},m.uniqueId=function(n){var t=++b; +return vr(null==n?"":n)+t},m.all=Dt,m.any=Mt,m.detect=$t,m.findWhere=$t,m.foldl=Pt,m.foldr=Kt,m.include=Rt,m.inject=Pt,rr(function(){var n={};return xt(m,function(t,r){m.prototype[r]||(n[r]=t)}),n}(),false),m.first=Vt,m.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=m.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:g;return h(n,zr(0,u-e))},m.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=Tt(n)),null==t||r?n?n[pt(0,n.length-1)]:g:(n=Lt(n),n.length=Pr(zr(0,t),n.length),n) +},m.take=Vt,m.head=Vt,xt(m,function(n,t){var r="sample"!==t;m.prototype[t]||(m.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 w(o,u):o})}),m.VERSION="2.4.1",m.prototype.chain=function(){return this.__chain__=true,this},m.prototype.toString=function(){return vr(this.__wrapped__)},m.prototype.value=or,m.prototype.valueOf=or,Bt(["join","pop","shift"],function(n){var t=yr[n];m.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); +return n?new w(r,n):r}}),Bt(["push","reverse","sort","unshift"],function(n){var t=yr[n];m.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Bt(["concat","slice","splice"],function(n){var t=yr[n];m.prototype[n]=function(){return new w(t.apply(this.__wrapped__,arguments),this.__chain__)}}),m}var g,y=[],m=[],b=0,d=+new Date+"",_=75,w=40,j=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=/\b__p\+='';/g,x=/\b(__p\+=)''\+/g,C=/(__e\(.*?\)|\b__t\))\+'';/g,O=/&(?:amp|lt|gt|quot|#39);/g,E=/[&<>"']/g,N=/<%-([\s\S]+?)%>/g,A=/<%([\s\S]+?)%>/g,I=/<%=([\s\S]+?)%>/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,T=/\w*$/,R=/^\s*function[ \n\r\t]+\w/,D=/^0[xX]/,F=/($^)/,$=/\bthis\b/,B=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),W="[object Arguments]",z="[object Array]",P="[object Boolean]",K="[object Date]",L="[object Function]",M="[object Number]",V="[object Object]",U="[object RegExp]",X="[object String]",G={}; +G[L]=false,G[W]=G[z]=G[P]=G[K]=G[M]=G[V]=G[U]=G[X]=true;var H={leading:false,maxWait:0,trailing:false},J={configurable:false,enumerable:false,value:null,writable:false},Q={"&":"&","<":"<",">":">",'"':""","'":"'"},Y={"&":"&","<":"<",">":">",""":'"',"'":"'"},Z={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},nt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},tt=Z[typeof window]&&window||this,rt=Z[typeof exports]&&exports&&!exports.nodeType&&exports,et=Z[typeof global]&&global; +!et||et.global!==et&&et.window!==et||(tt=et);var ut=(et=Z[typeof module]&&module&&!module.nodeType&&module)&&et.exports===rt&&rt,ot=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(tt._=ot, define(function(){return ot})):rt&&et?ut?(et.exports=ot)._=ot:rt._=ot:tt._=ot}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index cdf5294b6..54b07b7f4 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -21,15 +21,15 @@ /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ var keyPrefix = +new Date + ''; + /** Used to match HTML entities and HTML characters */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#x27);/g, + reUnescapedHtml = /[&<>"']/g; + /** Used to match template delimiters */ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#x27);/g, - reUnescapedHtml = /[&<>"']/g; - /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -456,7 +456,7 @@ function baseCreate(prototype, properties) { return isObject(prototype) ? nativeCreate(prototype) : {}; } - // fallback for browsers without `Object.create` + // fallback for environments without `Object.create` if (!nativeCreate) { baseCreate = (function() { function Object() {} @@ -932,7 +932,7 @@ return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == argsClass || false; } - // fallback for browsers that can't detect `arguments` objects by [[Class]] + // fallback for environments that can't detect `arguments` objects by [[Class]] if (!isArguments(arguments)) { isArguments = function(value) { return value && typeof value == 'object' && typeof value.length == 'number' && diff --git a/doc/README.md b/doc/README.md index 3e3ac8e5a..748045370 100644 --- a/doc/README.md +++ b/doc/README.md @@ -240,7 +240,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4515 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4561 "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#L4545 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4591 "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#L4590 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4636 "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#L4644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4690 "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#L4708 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4754 "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#L4769 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4815 "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#L4808 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4854 "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#L4871 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4917 "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#L4901 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4947 "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#L5003 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5049 "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)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5050 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5096 "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#L5080 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5126 "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#L5131 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5177 "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#L5184 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5230 "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#L5255 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5301 "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#L5321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5367 "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#L5352 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5398 "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#L5403 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5449 "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#L5431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5477 "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#L5452 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5498 "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#L5487 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5533 "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#L5517 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5563 "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#L668 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L692 "View in source") [Ⓣ][1] Creates a `lodash` object which wraps the given value to enable intuitive method chaining. @@ -1140,7 +1140,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6885 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6934 "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, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6912 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6961 "View in source") [Ⓣ][1] This method invokes `interceptor` and returns `value`. The interceptor is bound to `thisArg` and invoked with one argument; *(value)*. The purpose of this method is to "tap into" a method chain in order to perform operations on intermediate results within the chain. @@ -1203,7 +1203,7 @@ _([1, 2, 3, 4]) ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6942 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6991 "View in source") [Ⓣ][1] Enables explicit method chaining on the wrapper object. @@ -1237,7 +1237,7 @@ _(characters).chain() ### `_.prototype.toString()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7008 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1258,7 +1258,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6976 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7025 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1289,7 +1289,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection, [index])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3324 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3374 "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. @@ -1317,7 +1317,7 @@ _.at(['fred', 'barney', 'pebbles'], 0, 2); ### `_.contains(collection, target, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3417 "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. @@ -1355,7 +1355,7 @@ _.contains('pebbles', 'eb'); ### `_.countBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3430 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3480 "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)*. @@ -1391,7 +1391,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3475 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3525 "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)*. @@ -1437,7 +1437,7 @@ _.every(characters, { 'age': 36 }); ### `_.filter(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3536 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3586 "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)*. @@ -1483,7 +1483,7 @@ _.filter(characters, { 'age': 36 }); ### `_.find(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3653 "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)*. @@ -1532,7 +1532,7 @@ _.find(characters, 'blocked'); ### `_.findLast(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3648 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3698 "View in source") [Ⓣ][1] This method is like `_.find` except that it iterates over elements of a `collection` from right to left. @@ -1560,7 +1560,7 @@ _.findLast([1, 2, 3, 4], function(num) { ### `_.forEach(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3686 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3736 "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`. @@ -1594,7 +1594,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#L3719 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3769 "View in source") [Ⓣ][1] This method is like `_.forEach` except that it iterates over elements of a `collection` from right to left. @@ -1623,7 +1623,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#L3780 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3830 "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)*. @@ -1660,7 +1660,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.indexBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3823 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3873 "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)*. @@ -1701,7 +1701,7 @@ _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String); ### `_.invoke(collection, methodName, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3849 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3899 "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`. @@ -1730,7 +1730,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3901 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3951 "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)*. @@ -1775,7 +1775,7 @@ _.map(characters, 'name'); ### `_.max(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4009 "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)*. @@ -1817,7 +1817,7 @@ _.max(characters, 'age'); ### `_.min(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4034 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4084 "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)*. @@ -1859,7 +1859,7 @@ _.min(characters, 'age'); ### `_.pluck(collection, prop)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4089 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4139 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the collection. @@ -1889,7 +1889,7 @@ _.pluck(characters, 'name'); ### `_.reduce(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4121 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4171 "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)*. @@ -1927,7 +1927,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#L4164 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4214 "View in source") [Ⓣ][1] This method is like `_.reduce` except that it iterates over elements of a `collection` from right to left. @@ -1958,7 +1958,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#L4213 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4263 "View in source") [Ⓣ][1] The opposite of `_.filter`; this method returns the elements of a collection that the callback does **not** return truey for. @@ -2001,7 +2001,7 @@ _.reject(characters, { 'age': 36 }); ### `_.sample(collection, [n])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4289 "View in source") [Ⓣ][1] Retrieves a random element or `n` random elements from a collection. @@ -2029,7 +2029,7 @@ _.sample([1, 2, 3, 4], 2); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4267 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4317 "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. @@ -2053,7 +2053,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4300 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4351 "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. @@ -2083,7 +2083,7 @@ _.size('pebbles'); ### `_.some(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4347 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4398 "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)*. @@ -2129,7 +2129,7 @@ _.some(characters, { 'age': 1 }); ### `_.sortBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4417 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4468 "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)*. @@ -2179,7 +2179,7 @@ _.map(_.sortBy(characters, ['name', 'age']), _.values); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4463 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4509 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -2203,7 +2203,7 @@ Converts the `collection` to an array. ### `_.where(collection, props)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4543 "View in source") [Ⓣ][1] Performs a deep comparison between each element in `collection` and the `props` object, returning an array of all elements that have equivalent property values. @@ -2243,7 +2243,7 @@ _.where(characters, { 'pets': ['dino'] }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5562 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5608 "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. @@ -2276,7 +2276,7 @@ _.forEach(saves, function(type) { ### `_.bind(func, [thisArg], [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5595 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5641 "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. @@ -2307,7 +2307,7 @@ func(); ### `_.bindAll(object, [methodName])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5625 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5671 "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. @@ -2338,7 +2338,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5672 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5718 "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. @@ -2379,7 +2379,7 @@ func(); ### `_.compose([func])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5708 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5754 "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. @@ -2417,7 +2417,7 @@ welcome('pebbles'); ### `_.curry(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5756 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5802 "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. @@ -2452,7 +2452,7 @@ curried(1, 2, 3); ### `_.debounce(func, wait, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5800 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5846 "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. @@ -2496,7 +2496,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5916 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5962 "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. @@ -2521,7 +2521,7 @@ _.defer(function(text) { console.log(text); }, 'deferred'); ### `_.delay(func, wait, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5940 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5986 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be provided to `func` when it is invoked. @@ -2547,7 +2547,7 @@ _.delay(function(text) { console.log(text); }, 1000, 'later'); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5985 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6031 "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. @@ -2590,7 +2590,7 @@ get('pebbles'); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6018 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6064 "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. @@ -2616,7 +2616,7 @@ initialize(); ### `_.partial(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6056 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6102 "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. @@ -2643,7 +2643,7 @@ hi('fred'); ### `_.partialRight(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6087 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6133 "View in source") [Ⓣ][1] This method is like `_.partial` except that `partial` arguments are appended to those provided to the new function. @@ -2680,7 +2680,7 @@ options.imports ### `_.throttle(func, wait, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6122 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6168 "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. @@ -2716,7 +2716,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6163 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6209 "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. @@ -2752,7 +2752,7 @@ p('Fred, Wilma, & Pebbles'); ### `_.assign(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2029 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2079 "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)*. @@ -2790,7 +2790,7 @@ defaults(object, { 'name': 'fred', 'employer': 'slate' }); ### `_.clone(value, [isDeep=false], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2095 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2145 "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)*. @@ -2837,7 +2837,7 @@ clone.childNodes.length; ### `_.cloneDeep(value, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2148 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2198 "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)*. @@ -2883,7 +2883,7 @@ clone.node == view.node; ### `_.create(prototype, [properties])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2183 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2233 "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. @@ -2923,7 +2923,7 @@ circle instanceof Shape; ### `_.defaults(object, [source])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2257 "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. @@ -2949,7 +2949,7 @@ _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); ### `_.findKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2271 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2321 "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. @@ -2995,7 +2995,7 @@ _.findKey(characters, 'blocked'); ### `_.findLastKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2324 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2374 "View in source") [Ⓣ][1] This method is like `_.findKey` except that it iterates over elements of a `collection` in the opposite order. @@ -3041,7 +3041,7 @@ _.findLastKey(characters, 'blocked'); ### `_.forIn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2417 "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`. @@ -3079,7 +3079,7 @@ _.forIn(new Shape, function(value, key) { ### `_.forInRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2403 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2453 "View in source") [Ⓣ][1] This method is like `_.forIn` except that it iterates over elements of a `collection` in the opposite order. @@ -3117,7 +3117,7 @@ _.forInRight(new Shape, function(value, key) { ### `_.forOwn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2440 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2490 "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`. @@ -3145,7 +3145,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#L2473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2523 "View in source") [Ⓣ][1] This method is like `_.forOwn` except that it iterates over elements of a `collection` in the opposite order. @@ -3173,7 +3173,7 @@ _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2502 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2552 "View in source") [Ⓣ][1] Creates a sorted array of property names of all enumerable properties, own and inherited, of `object` that have function values. @@ -3200,7 +3200,7 @@ _.functions(_); ### `_.has(object, key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2527 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2577 "View in source") [Ⓣ][1] Checks if the specified property name exists as a direct property of `object`, instead of an inherited property. @@ -3225,7 +3225,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object, [multiValue=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2556 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2606 "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`. @@ -3258,7 +3258,7 @@ _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }, true); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1923 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1973 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -3285,7 +3285,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1952 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2002 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -3312,7 +3312,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2592 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2642 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -3336,7 +3336,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2610 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2660 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -3360,7 +3360,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2627 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2677 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -3384,7 +3384,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2660 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2710 "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". @@ -3414,7 +3414,7 @@ _.isEmpty(''); ### `_.isEqual(a, b, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2717 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2767 "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)*. @@ -3459,7 +3459,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2750 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2800 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -3497,7 +3497,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2767 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2817 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -3521,7 +3521,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2881 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -3556,7 +3556,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2853 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2903 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3583,7 +3583,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2873 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2923 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3609,7 +3609,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2797 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2847 "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('')`)* @@ -3639,7 +3639,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2902 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2952 "View in source") [Ⓣ][1] Checks if `value` is an object created by the `Object` constructor. @@ -3674,7 +3674,7 @@ _.isPlainObject({ 'x': 0, 'y': 0 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2927 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2977 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3698,7 +3698,7 @@ _.isRegExp(/fred/); ### `_.isString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2944 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2994 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3722,7 +3722,7 @@ _.isString('fred'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2962 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3012 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3746,7 +3746,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1987 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2037 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of an object. @@ -3770,7 +3770,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.mapValues(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3002 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3052 "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)*. @@ -3809,7 +3809,7 @@ _.mapValues(characters, 'age'); ### `_.merge(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3063 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3113 "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)*. @@ -3865,7 +3865,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3119 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3169 "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)*. @@ -3896,7 +3896,7 @@ _.omit({ 'name': 'fred', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3160 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3210 "View in source") [Ⓣ][1] Creates a two dimensional array of an object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3920,7 +3920,7 @@ _.pairs({ 'barney': 36, 'fred': 40 }); ### `_.pick(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3200 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3250 "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)*. @@ -3951,7 +3951,7 @@ _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { ### `_.transform(object, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3255 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3305 "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`. @@ -3988,7 +3988,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#L3289 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3339 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -4019,7 +4019,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.now` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6440 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6486 "View in source") [Ⓣ][1] *(unknown)*: Gets the number of milliseconds that have elapsed since the Unix epoch *(1 January `1970 00`:00:00 UTC)*. @@ -4038,7 +4038,7 @@ _.defer(function() { console.log(_.now() - stamp); }); ### `_.constant(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6184 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6230 "View in source") [Ⓣ][1] Creates a function that returns `value`. @@ -4064,7 +4064,7 @@ getter() === object; ### `_.createCallback([func=identity], [thisArg], [argCount])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6221 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6267 "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`. @@ -4103,7 +4103,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#L6293 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -4129,7 +4129,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#L6311 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -4154,7 +4154,7 @@ _.identity(object) === object; ### `_.match(props)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6294 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6340 "View in source") [Ⓣ][1] Creates a "_.where" style function, which performs a deep comparison between a given object and the `props` object, returning `true` if the given object has equivalent property values, else `false`. @@ -4188,7 +4188,7 @@ _.find(characters, matchAge); ### `_.mixin([object=lodash], source, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6350 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6396 "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. @@ -4224,7 +4224,7 @@ _('fred').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6406 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6452 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -4244,7 +4244,7 @@ var lodash = _.noConflict(); ### `_.noop()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6423 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6469 "View in source") [Ⓣ][1] A no-operation function. @@ -4263,7 +4263,7 @@ _.noop(object) === undefined; ### `_.parseInt(value, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6510 "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. @@ -4290,7 +4290,7 @@ _.parseInt('08'); ### `_.property(key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6493 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6541 "View in source") [Ⓣ][1] Creates a "_.pluck" style function, which returns the `key` value of a given object. @@ -4324,7 +4324,7 @@ _.sortBy(characters, getName); ### `_.random([min=0], [max=1], [floating=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6526 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6574 "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. @@ -4359,7 +4359,7 @@ _.random(1.2, 5.2); ### `_.result(object, key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6584 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6633 "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. @@ -4394,7 +4394,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=root])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L485 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L515 "View in source") [Ⓣ][1] Create a new `lodash` function using the given context object. @@ -4412,7 +4412,7 @@ Create a new `lodash` function using the given context object. ### `_.template(text, data, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6677 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6726 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4504,7 +4504,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6800 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6849 "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)*. @@ -4536,7 +4536,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6830 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6879 "View in source") [Ⓣ][1] The inverse of `_.escape`; this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -4562,7 +4562,7 @@ _.unescape('Fred, Barney & Pebbles'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6903 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is provided the ID will be appended to it. @@ -4596,7 +4596,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L900 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L924 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -4615,7 +4615,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7177 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7226 "View in source") [Ⓣ][1] *(string)*: The semantic version number. @@ -4627,7 +4627,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L721 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -4639,7 +4639,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L714 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L738 "View in source") [Ⓣ][1] *(boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -4651,7 +4651,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L746 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -4663,7 +4663,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L731 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L755 "View in source") [Ⓣ][1] *(boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -4675,7 +4675,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L744 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L768 "View in source") [Ⓣ][1] *(boolean)*: Detect if `prototype` properties are enumerable by default. @@ -4689,7 +4689,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#L753 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L777 "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)*. @@ -4701,7 +4701,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#L761 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L785 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Function#name` is supported *(all but IE)*. @@ -4713,7 +4713,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#L770 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L794 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -4725,7 +4725,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#L781 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L805 "View in source") [Ⓣ][1] *(boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -4739,7 +4739,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#L789 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L813 "View in source") [Ⓣ][1] *(boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -4751,7 +4751,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#L803 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L827 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -4765,7 +4765,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#L814 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L838 "View in source") [Ⓣ][1] *(boolean)*: Detect lack of support for accessing string characters by index. @@ -4779,7 +4779,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#L852 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L876 "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. @@ -4791,7 +4791,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#L860 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L884 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -4803,7 +4803,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#L868 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L892 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -4815,7 +4815,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#L876 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L900 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -4827,7 +4827,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#L884 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L908 "View in source") [Ⓣ][1] *(string)*: Used to reference the data object in the template text. @@ -4839,7 +4839,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#L892 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L916 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. diff --git a/lodash.js b/lodash.js index f9d7cb2a4..ea45e4593 100644 --- a/lodash.js +++ b/lodash.js @@ -30,7 +30,7 @@ /** Used as the max size of the `arrayPool` and `objectPool` */ var maxPoolSize = 40; - /** Used to detect and test whitespace */ + /** Used to detect and test whitespace (unicode 6.3.0) */ var whitespace = ( // whitespace ' \t\x0B\f\xA0\ufeff' + @@ -39,7 +39,7 @@ '\n\r\u2028\u2029' + // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' + '\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' ); /** Used to match empty string literals in compiled template source */ @@ -47,6 +47,15 @@ reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + /** Used to match HTML entities and HTML characters */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g; + + /** Used to match template delimiters */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + /** * Used to match ES6 template delimiters * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals @@ -59,17 +68,11 @@ /** Used to detected named functions */ var reFuncName = /^\s*function[ \n\r\t]+\w/; - /** Used to match template delimiters */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect hexadecimal string values */ + var reHexPrefix = /^0[xX]/; - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); + /** Used to match leading whitespace in strings */ + var reLeadingWhitespace = RegExp('^[' + whitespace + ']+'); /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -585,7 +588,8 @@ nativeMax = Math.max, nativeMin = Math.min, nativeParseInt = context.parseInt, - nativeRandom = Math.random; + nativeRandom = Math.random, + nativeTrim = isNative(nativeTrim = stringProto.trim) && nativeTrim; /** Used to lookup a built-in constructor by [[Class]] */ var ctorByClass = {}; @@ -1146,7 +1150,7 @@ function baseCreate(prototype, properties) { return isObject(prototype) ? nativeCreate(prototype) : {}; } - // fallback for browsers without `Object.create` + // fallback for environments without `Object.create` if (!nativeCreate) { baseCreate = (function() { function Object() {} @@ -1911,6 +1915,32 @@ return typeof result == 'undefined' || hasOwnProperty.call(value, result); } + /** + * Removes leading and trailing whitespace from a given string. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function trim(string) { + return string == null ? '' : nativeTrim.call(string); + } + // fallback for environments without a proper `String#trim` + if (!nativeTrim || nativeTrim.call(whitespace)) { + trim = function(string) { + var start = -1, + end = string ? string.length : 0; + + if (!end || string == null) { + return ''; + } + string = String(string); + while (whitespace.indexOf(string.charAt(++start)) > -1) { } + while (whitespace.indexOf(string.charAt(--end)) > -1) { } + return string.slice(start, end + 1); + }; + } + /** * Used by `unescape` to convert HTML entities to characters. * @@ -1944,7 +1974,7 @@ return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == argsClass || false; } - // fallback for browsers that can't detect `arguments` objects by [[Class]] + // fallback for environments that can't detect `arguments` objects by [[Class]] if (!support.argsClass) { isArguments = function(value) { return value && typeof value == 'object' && typeof value.length == 'number' && @@ -6478,8 +6508,10 @@ * // => 8 */ var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); + // Chrome fails to trim leading whitespace characters. + // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`. + value = trim(value); + return nativeParseInt(value, +radix || (reHexPrefix.test(value) ? 16 : 10)); }; /** diff --git a/test/test.js b/test/test.js index e7157da67..c02c933ca 100644 --- a/test/test.js +++ b/test/test.js @@ -2928,7 +2928,7 @@ (function() { test('should return the function names of an object', 1, function() { - var object = { 'a': 'a', 'b': _.identity, 'c': /x/, 'd': _.each }; + var object = { 'a': 'a', 'b': _.identity, 'c': /x/, 'd': _.forEach }; deepEqual(_.functions(object), ['b', 'd']); }); @@ -5722,22 +5722,56 @@ QUnit.module('lodash.parseInt'); (function() { - test('should parse strings with leading whitespace and zeros with a `radix` of 10 by default (test in Chrome, Firefox, and Opera)', 2, function() { - var whitespace = ' \x09\x0B\x0C\xA0\ufeff\x0A\x0D\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; - equal(_.parseInt('08'), 8); - equal(_.parseInt(whitespace + '08'), 8); + var whitespace = ' \t\x0B\f\xA0\ufeff\n\r\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; + + test('should accept a `radix` argument', function() { + var expected = _.range(2, 37); + + var actual = _.map(expected, function(radix) { + return _.parseInt('10', radix); + }); + + deepEqual(actual, expected); }); - test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', 3, function() { - equal(_.parseInt('10', 0), 10); - equal(_.parseInt('10'), 10); - equal(_.parseInt('10', undefined), 10); + test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', 4, function() { + strictEqual(_.parseInt('10'), 10); + strictEqual(_.parseInt('10', 0), 10); + strictEqual(_.parseInt('10', 10), 10); + strictEqual(_.parseInt('10', undefined), 10); }); - test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', 3, function() { - equal(_.parseInt('0x20', 0), 32); - equal(_.parseInt('0x20'), 32); - equal(_.parseInt('0x20', undefined), 32); + test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', 8, function() { + _.forEach(['0x20', '0X20'], function(string) { + strictEqual(_.parseInt(string), 32); + strictEqual(_.parseInt(string, 0), 32); + strictEqual(_.parseInt(string, 16), 32); + strictEqual(_.parseInt(string, undefined), 32); + }); + }); + + test('should use a radix of `10` for string with leading zeros', 2, function() { + strictEqual(_.parseInt('08'), 8); + strictEqual(_.parseInt('08', 10), 8); + }); + + test('should parse strings with leading whitespace (test in Chrome, Firefox, and Opera)', 8, function() { + strictEqual(_.parseInt(whitespace + '10'), 10); + strictEqual(_.parseInt(whitespace + '10', 10), 10); + + strictEqual(_.parseInt(whitespace + '08'), 8); + strictEqual(_.parseInt(whitespace + '08', 10), 8); + + _.forEach(['0x20', '0X20'], function(string) { + strictEqual(_.parseInt(whitespace + string), 32); + strictEqual(_.parseInt(whitespace + string, 16), 32); + }); + }); + + test('should coerce `radix` to a number', function() { + var object = { 'valueOf': function() { return 0; } }; + strictEqual(_.parseInt('08', object), 8); + strictEqual(_.parseInt('0x20', object), 32); }); }()); @@ -7112,7 +7146,7 @@ (function() { test('should use a `with` statement by default', 1, function() { - var compiled = _.template('<%= index %><%= collection[index] %><% _.each(collection, function(value, index) { %><%= index %><% }); %>'), + var compiled = _.template('<%= index %><%= collection[index] %><% _.forEach(collection, function(value, index) { %><%= index %><% }); %>'), actual = compiled({ 'index': 1, 'collection': ['a', 'b', 'c'] }); equal(actual, '1b012'); @@ -7204,7 +7238,7 @@ 'interpolate': /\{\{=([\s\S]+?)\}\}/g }); - var compiled = _.template('
    {{ _.each(collection, function(value, index) { }}
  • {{= index }}: {{- value }}
  • {{ }); }}
'), + var compiled = _.template('
    {{ _.forEach(collection, function(value, index) { }}
  • {{= index }}: {{- value }}
  • {{ }); }}
'), expected = '
  • 0: a & A
  • 1: b & B
'; equal(compiled({ 'collection': ['a & A', 'b & B'] }), expected); @@ -7220,7 +7254,7 @@ 'interpolate': /<\?=([\s\S]+?)\?>/g }); - var compiled = _.template('
  • :
'), + var compiled = _.template('
  • :
'), expected = '
  • 0: a & A
  • 1: b & B
'; equal(compiled({ 'collection': ['a & A', 'b & B'] }), expected);