diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 401a6e154..89c1aac19 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -441,6 +441,23 @@ return typeof value.toString != 'function' && typeof (value + '') == 'string'; } + /** + * Checks the given string to determine if the character at the specified + * index is whitespace. + * + * @private + * @param {string} string The string to inspect. + * @param {number} index The character index. + * @returns {boolean} Returns `true` if specifed character is whitespace, else `false`. + */ + function isWhitespaceAt(string, index) { + var c = string.charCodeAt(index); + return ( + (c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || + (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)) + ); + } + /** * Releases the given array back to the array pool. * @@ -1915,8 +1932,8 @@ return ''; } string = String(string); - while (whitespace.indexOf(string.charAt(++start)) > -1) { } - while (whitespace.indexOf(string.charAt(--end)) > -1) { } + while (++start < end && isWhitespaceAt(string, start)) { } + while (end-- && isWhitespaceAt(string, end)) { } return string.slice(start, end + 1); }; } diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 8e19d2331..93f1479d1 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,60 +3,60 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(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(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 +;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(n=r&&9<=r&&13>=r||32==r||160==r||5760==r||6158==r||8192<=r&&(8202>=r||8232==r||8233==r||8239==r||8287==r||12288==r||65279==r)}function g(n){n.length=0,d.lengthr?0:r);++e=j&&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&&h(e),l}function ct(n,t,r){var e=-1,u=n,o=n?n.length:0;if(t=t&&typeof r=="undefined"?t:at(t,r,3),typeof o=="number")for(Zr.unindexedChars&&Dt(u)&&(u=u.split(""));++e=j&&a===t,s=u||p?l():c;for(p&&(s=i(s),a=r);++oa(s,y))&&((u||p)&&s.push(y),c.push(v))}return p?(g(s.g),h(s)):u&&g(s),c}function yt(n){return function(t,r,u){var o={};if(r=e.createCallback(r,u,3),te(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;")+"}")(at,U,wr,Pr,kt,jr,et,Yr,Q,xr,Or) +}function bt(n){return tt[n]}function _t(){var n=(n=e.indexOf)===Jt?t:n;return n}function wt(n){return typeof n=="function"&&Er.test(Nr.call(n))}function jt(n){var t,r;return!n||Or.call(n)!=H||(t=n.constructor,Tt(t)&&!(t instanceof t))||!Zr.argsClass&&kt(n)||!Zr.nodeClass&&p(n)?false:Zr.ownLast?(ue(n,function(n,t,e){return r=Pr.call(e,t),false}),false!==r):(ue(n,function(n,t){r=t}),typeof r=="undefined"||Pr.call(n,r))}function xt(n){return null==n?"":Jr.call(n)}function Ct(n){return rt[n]}function kt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n)==z||false +}function Ot(n,t,r){var e=arguments,u=0,o=typeof r=="number"?2:e.length;if(3=e)return false;if(typeof n=="string"||!te(n)&&Dt(n))return Lr?Lr.call(n,t,r):-1r?Ur(0,e+r):r)||0,-1a&&(a=f)}}else t=null==t&&Dt(n)?u:e.createCallback(t,r,3),ct(n,function(n,r,e){r=t(n,r,e),r>o&&(o=r,a=n)});return a}function Vt(n,t,r,u){var o=3>arguments.length;if(t=e.createCallback(t,u,4),te(n)){var a=-1,i=n.length;for(o&&i&&(r=n[++a]);++aarguments.length;return t=e.createCallback(t,u,4),zt(n,function(n,e,u){r=o?(o=false,n):t(r,n,e,u)}),r}function Xt(n){var t=-1,r=n?n.length:0,e=cr(typeof r=="number"?r:0);return Wt(n,function(n){var r=ht(0,++t);e[t]=e[r],e[r]=n}),e}function Gt(n,t,r){var u;if(t=e.createCallback(t,r,3),te(n)){r=-1;for(var o=n.length;++re?Ur(0,u+e):e||0}else if(e)return e=Yt(n,r),n[e]===r?e:-1;return t(n,r,e)}function Qt(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=Ar(u)),c=a,o=n.apply(i,e)):u||(u=qr(v,y))}return m&&f?f=Ar(f):f||t===p||(f=qr(h,t)),r&&(m=true,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function ur(n){return n}function or(n){n||(n={});var t=ee(n),r=t[0],e=n[r];return 1!=t.length||e!==e||Pt(e)?function(r){for(var e=t.length,u=false;e--&&(u=st(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 ar(n,t,r){var u=true,o=t&&It(t);t&&(r||o.length)||(null==r&&(r=t),a=d,t=n,n=e,o=It(t)),false===r?u=false:Pt(r)&&"chain"in r&&(u=r.chain); +var a=n,i=Tt(a);Wt(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&&Pt(o))return this;o=new a(o),o.__chain__=t}return o})})}function ir(){}function fr(n){return function(t){return t[n]}}function lr(){return this.__wrapped__}n=n?lt.defaults(ot.Object(),n,lt.pick(ot,L)):ot;var cr=n.Array,pr=n.Boolean,sr=n.Date,gr=n.Function,hr=n.Math,vr=n.Number,yr=n.Object,mr=n.RegExp,dr=n.String,br=n.TypeError,_r=cr.prototype,wr=n.Error.prototype,jr=yr.prototype,xr=dr.prototype,Cr=(Cr=n.window)&&Cr.document,kr=n._,Or=jr.toString,Er=mr("^"+dr(Or).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Sr=hr.ceil,Ar=n.clearTimeout,Ir=hr.floor,Nr=gr.prototype.toString,Tr=wt(Tr=yr.getPrototypeOf)&&Tr,Pr=jr.hasOwnProperty,Rr=_r.push,Dr=jr.propertyIsEnumerable,qr=n.setTimeout,Fr=_r.splice,$r=_r.unshift,Br=function(){try{var n={},t=wt(t=yr.defineProperty)&&t,r=t(n,n,n)&&t +}catch(e){}return r}(),Lr=wt(Lr=xr.contains)&&Lr,Wr=wt(Wr=yr.create)&&Wr,zr=wt(zr=cr.isArray)&&zr,Kr=n.isFinite,Mr=n.isNaN,Vr=wt(Vr=yr.keys)&&Vr,Ur=hr.max,Xr=hr.min,Gr=n.parseInt,Hr=hr.random,Jr=wt(Jr=xr.trim)&&Jr,Qr={};Qr[K]=cr,Qr[M]=pr,Qr[V]=sr,Qr[X]=gr,Qr[H]=yr,Qr[G]=vr,Qr[J]=mr,Qr[Q]=dr;var Yr={};Yr[K]=Yr[V]=Yr[G]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Yr[M]=Yr[Q]={constructor:true,toString:true,valueOf:true},Yr[U]=Yr[X]=Yr[J]={constructor:true,toString:true},Yr[H]={constructor:true},function(){for(var n=W.length;n--;){var t,r=W[n]; +for(t in Yr)Pr.call(Yr,t)&&!Pr.call(Yr[t],r)&&(Yr[t][r]=false)}}(),d.prototype=e.prototype;var Zr=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);Zr.argsClass=Or.call(arguments)==z,Zr.argsObject=arguments.constructor==yr&&!(arguments instanceof cr),Zr.enumErrorProps=Dr.call(wr,"message")||Dr.call(wr,"name"),Zr.enumPrototypes=Dr.call(t,"prototype"),Zr.funcDecomp=!wt(n.WinRTError)&&$.test(y),Zr.funcNames=typeof gr.name=="string",Zr.nonEnumArgs=0!=u,Zr.nonEnumShadows=!/valueOf/.test(e),Zr.ownLast="x"!=e[0],Zr.spliceObjects=(Fr.call(r,0,1),!r[0]),Zr.unindexedChars="xx"!="x"[0]+yr("x")[0]; +try{Zr.dom=11===Cr.createDocumentFragment().nodeType}catch(o){Zr.dom=false}try{Zr.nodeClass=!(Or.call(undefined)==H&&!({toString:0}+""))}catch(a){Zr.nodeClass=true}}(1),e.templateSettings={escape:I,evaluate:N,interpolate:T,variable:"",imports:{_:e}},Wr||(ut=function(){function t(){}return function(r){if(Pt(r)){t.prototype=r;var e=new t;t.prototype=null}return e||n.Object()}}());var ne=Br?function(n,t){nt.value=t,Br(n,"__bindData__",nt)}:ir;(!Jr||Jr.call(C))&&(xt=function(n){var t=-1,r=n?n.length:0;if(!r||null==n)return"";for(n=dr(n);++t--n?t.apply(this,arguments):void 0}},e.assign=Ot,e.at=function(n){var t=arguments,r=-1,e=pt(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=cr(t);for(Zr.unindexedChars&&Dt(n)&&(n=n.split(""));++r=j&&i(e?n[e]:c)))}var f=n[0],s=-1,v=f?f.length:0,y=[];n:for(;++s(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])&&h(m);return g(o),g(c),y},e.invert=function(n,t){for(var r=-1,e=ee(n),u=e.length,o={};++rr?Ur(0,e+r):Xr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},e.mixin=ar,e.noConflict=function(){return n._=kr,this},e.noop=ir,e.now=ce,e.parseInt=pe,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=Hr(),Xr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):ht(n,t) +},e.reduce=Vt,e.reduceRight=Ut,e.result=function(n,t){if(n){var r=n[t];return Tt(r)?n[t]():r}},e.runInContext=y,e.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ee(n).length},e.some=Gt,e.sortedIndex=Yt,e.template=function(n,t,r){var u=e.templateSettings;n=dr(n||""),r=Et({},r,u);var o,a=Et({},r.imports,u.imports),u=ee(a),a=qt(a),i=0,l=r.interpolate||F,c="__p+='",l=mr((r.escape||F).source+"|"+l.source+"|"+(l===T?P:F).source+"|"+(r.evaluate||F).source+"|$","g");n.replace(l,function(t,r,e,u,a,l){return e||(e=u),c+=n.slice(i,l).replace(B,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(k,""):c).replace(O,"$1").replace(E,"$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=gr(u,"return "+c).apply(m,a)}catch(s){throw s.source=c,s}return t?p(t):(p.source=c,p)},e.unescape=function(n){return null==n?"":(n=dr(n),0>n.indexOf(";")?n:n.replace(S,Ct))},e.uniqueId=function(n){var t=++_; +return dr(null==n?"":n)+t},e.all=$t,e.any=Gt,e.detect=Lt,e.findWhere=Lt,e.foldl=Vt,e.foldr=Ut,e.include=Ft,e.inject=Vt,ar(function(){var n={};return St(e,function(t,r){e.prototype[r]||(n[r]=t)}),n}(),false),e.first=Ht,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]:m;return v(n,Ur(0,o-u))},e.sample=function(n,t,r){return n&&typeof n.length!="number"?n=qt(n):Zr.unindexedChars&&Dt(n)&&(n=n.split("")),null==t||r?n?n[ht(0,n.length-1)]:m:(n=Xt(n),n.length=Xr(Ur(0,t),n.length),n) +},e.take=Ht,e.head=Ht,St(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 d(o,u):o})}),e.VERSION="2.4.1",e.prototype.chain=function(){return this.__chain__=true,this},e.prototype.toString=function(){return dr(this.__wrapped__)},e.prototype.value=lr,e.prototype.valueOf=lr,ct(["join","pop","shift"],function(n){var t=_r[n];e.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); +return n?new d(r,n):r}}),ct(["push","reverse","sort","unshift"],function(n){var t=_r[n];e.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ct(["concat","slice","splice"],function(n){var t=_r[n];e.prototype[n]=function(){return new d(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Zr.spliceObjects||ct(["pop","shift","splice"],function(n){var t=_r[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 d(u,n):u +}}),e}var m,d=[],b=[],_=0,w=+new Date+"",j=75,x=40,C=" \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,O=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,S=/&(?:amp|lt|gt|quot|#39);/g,A=/[&<>"']/g,I=/<%-([\s\S]+?)%>/g,N=/<%([\s\S]+?)%>/g,T=/<%=([\s\S]+?)%>/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,R=/\w*$/,D=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,F=/($^)/,$=/\bthis\b/,B=/['\n\r\t\u2028\u2029\\]/g,L="Array Boolean Date Error Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),W="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),z="[object Arguments]",K="[object Array]",M="[object Boolean]",V="[object Date]",U="[object Error]",X="[object Function]",G="[object Number]",H="[object Object]",J="[object RegExp]",Q="[object String]",Y={}; +Y[X]=false,Y[z]=Y[K]=Y[M]=Y[V]=Y[G]=Y[H]=Y[J]=Y[Q]=true;var Z={leading:false,maxWait:0,trailing:false},nt={configurable:false,enumerable:false,value:null,writable:false},tt={"&":"&","<":"<",">":">",'"':""","'":"'"},rt={"&":"&","<":"<",">":">",""":'"',"'":"'"},et={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},ut={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ot=et[typeof window]&&window||this,at=et[typeof exports]&&exports&&!exports.nodeType&&exports,it=et[typeof global]&&global; +!it||it.global!==it&&it.window!==it||(ot=it);var ft=(it=et[typeof module]&&module&&!module.nodeType&&module)&&it.exports===at&&at,lt=y();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ot._=lt, define(function(){return lt})):at&&it?ft?(it.exports=lt)._=lt:at._=lt:ot._=lt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 369715084..d558c6844 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -418,6 +418,23 @@ }; } + /** + * Checks the given string to determine if the character at the specified + * index is whitespace. + * + * @private + * @param {string} string The string to inspect. + * @param {number} index The character index. + * @returns {boolean} Returns `true` if specifed character is whitespace, else `false`. + */ + function isWhitespaceAt(string, index) { + var c = string.charCodeAt(index); + return ( + (c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || + (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)) + ); + } + /** * Releases the given array back to the array pool. * @@ -1614,8 +1631,8 @@ return ''; } string = String(string); - while (whitespace.indexOf(string.charAt(++start)) > -1) { } - while (whitespace.indexOf(string.charAt(--end)) > -1) { } + while (++start < end && isWhitespaceAt(string, start)) { } + while (end-- && isWhitespaceAt(string, end)) { } return string.slice(start, end + 1); }; } diff --git a/dist/lodash.min.js b/dist/lodash.min.js index d250b91e7..fea0e8ad4 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(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 +;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(n=r&&9<=r&&13>=r||32==r||160==r||5760==r||6158==r||8192<=r&&(8202>=r||8232==r||8233==r||8239==r||8287==r||12288==r||65279==r)}function s(n){n.length=0,m.lengthr?0:r);++e=w&&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&&v(e),l}function lt(n,t,r,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e=w&&i===t,h=u||p?l():c; +for(p&&(h=a(h),i=r);++oi(h,y))&&((u||p)&&h.push(y),c.push(g))}return p?(s(h.g),v(h)):u&&s(h),c}function ht(n){return function(t,r,e){var u={};r=b.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"||!Jr(n)&&At(n))return Fr?Fr.call(n,t,r):-1r?Pr(0,e+r):r)||0,-1o&&(o=a)}}else t=null==t&&At(n)?u:b.createCallback(t,r,3),qt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function Kt(n,t,r,e){var u=3>arguments.length;t=b.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=b.createCallback(t,e,4),Wt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Mt(n){var t=-1,r=n?n.length:0,e=ar(typeof r=="number"?r:0);return qt(n,function(n){var r=st(0,++t);e[t]=e[r],e[r]=n}),e}function Vt(n,t,r){var e;t=b.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++re?Pr(0,u+e):e||0}else if(e)return e=Ht(n,r),n[e]===r?e:-1;return t(n,r,e)}function Gt(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=b.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++t=y; +m?(i&&(i=Cr(i)),s=f,a=n.apply(l,o)):i||(i=Tr(e,y))}return m&&c?c=Cr(c):c||t===v||(c=Tr(u,t)),r&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function tr(n){return n}function rr(n){n||(n={});var t=Qr(n),r=t[0],e=n[r];return 1!=t.length||e!==e||St(e)?function(r){for(var e=t.length,u=false;e--&&(u=ct(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 er(n,t,r){var e=true,u=t&&Et(t);t&&(r||u.length)||(null==r&&(r=t),o=j,t=n,n=b,u=Et(t)),false===r?e=false:St(r)&&"chain"in r&&(e=r.chain); +var o=n,i=It(o);qt(u,function(r){var u=n[r]=t[r];i&&(o.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,i=[r];if(Sr.apply(i,arguments),i=u.apply(n,i),e||t){if(r===i&&St(i))return this;i=new o(i),i.__chain__=t}return i})})}function ur(){}function or(n){return function(t){return t[n]}}function ir(){return this.__wrapped__}n=n?it.defaults(rt.Object(),n,it.pick(rt,W)):rt;var ar=n.Array,fr=n.Boolean,lr=n.Date,cr=n.Function,pr=n.Math,sr=n.Number,vr=n.Object,hr=n.RegExp,gr=n.String,yr=n.TypeError,mr=ar.prototype,br=vr.prototype,dr=gr.prototype,_r=(_r=n.window)&&_r.document,wr=n._,jr=br.toString,kr=hr("^"+gr(jr).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xr=pr.ceil,Cr=n.clearTimeout,Or=pr.floor,Er=cr.prototype.toString,Nr=bt(Nr=vr.getPrototypeOf)&&Nr,Ir=br.hasOwnProperty,Sr=mr.push,Tr=n.setTimeout,Ar=mr.splice,Rr=mr.unshift,Dr=function(){try{var n={},t=bt(t=vr.defineProperty)&&t,r=t(n,n,n)&&t +}catch(e){}return r}(),Fr=bt(Fr=dr.contains)&&Fr,$r=bt($r=vr.create)&&$r,Br=bt(Br=ar.isArray)&&Br,qr=n.isFinite,Wr=n.isNaN,zr=bt(zr=vr.keys)&&zr,Pr=pr.max,Kr=pr.min,Lr=n.parseInt,Mr=pr.random,Vr=bt(Vr=dr.trim)&&Vr,Ur={};Ur[P]=ar,Ur[K]=fr,Ur[L]=lr,Ur[M]=cr,Ur[U]=vr,Ur[V]=sr,Ur[X]=hr,Ur[G]=gr,j.prototype=b.prototype;var Xr=b.support={};Xr.funcDecomp=!bt(n.WinRTError)&&B.test(g),Xr.funcNames=typeof cr.name=="string";try{Xr.dom=11===_r.createDocumentFragment().nodeType}catch(Gr){Xr.dom=false}b.templateSettings={escape:I,evaluate:S,interpolate:T,variable:"",imports:{_:b}},$r||(ut=function(){function t(){}return function(r){if(St(r)){t.prototype=r; +var e=new t;t.prototype=null}return e||n.Object()}}());var Hr=Dr?function(n,t){Q.value=t,Dr(n,"__bindData__",Q)}:ur;(!Vr||Vr.call(k))&&(_t=function(n){var t=-1,r=n?n.length:0;if(!r||null==n)return"";for(n=gr(n);++t--n?t.apply(this,arguments):void 0}},b.assign=kt,b.at=function(n){for(var t=arguments,r=-1,e=lt(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=ar(t);++r=w&&a(e?n[e]:c)))}var f=n[0],h=-1,g=f?f.length:0,y=[];n:for(;++h(m?r(m,p):i(c,p))){for(e=u,(m||c).push(p);--e;)if(m=o[e],0>(m?r(m,p):i(n[e],p)))continue n;y.push(p)}}for(;u--;)(m=o[u])&&v(m);return s(o),s(c),y},b.invert=function(n,t){for(var r=-1,e=Qr(n),u=e.length,o={};++rr?Pr(0,e+r):Kr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},b.mixin=er,b.noConflict=function(){return n._=wr,this},b.noop=ur,b.now=ee,b.parseInt=ue,b.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=Mr(),Kr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):st(n,t) +},b.reduce=Kt,b.reduceRight=Lt,b.result=function(n,t){if(n){var r=n[t];return It(r)?n[t]():r}},b.runInContext=g,b.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Qr(n).length},b.some=Vt,b.sortedIndex=Ht,b.template=function(n,t,r){var e=b.templateSettings;n=gr(n||""),r=xt({},r,e);var u,o=xt({},r.imports,e.imports),e=Qr(o),o=Rt(o),i=0,a=r.interpolate||$,l="__p+='",a=hr((r.escape||$).source+"|"+a.source+"|"+(a===T?A:$).source+"|"+(r.evaluate||$).source+"|$","g");n.replace(a,function(t,r,e,o,a,c){return e||(e=o),l+=n.slice(i,c).replace(q,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(x,""):l).replace(C,"$1").replace(O,"$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=cr(e,"return "+l).apply(y,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},b.unescape=function(n){return null==n?"":(n=gr(n),0>n.indexOf(";")?n:n.replace(E,wt))},b.uniqueId=function(n){var t=++d; +return gr(null==n?"":n)+t},b.all=Ft,b.any=Vt,b.detect=Bt,b.findWhere=Bt,b.foldl=Kt,b.foldr=Lt,b.include=Dt,b.inject=Kt,er(function(){var n={};return Ct(b,function(t,r){b.prototype[r]||(n[r]=t)}),n}(),false),b.first=Ut,b.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=b.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:y;return h(n,Pr(0,u-e))},b.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=Rt(n)),null==t||r?n?n[st(0,n.length-1)]:y:(n=Mt(n),n.length=Kr(Pr(0,t),n.length),n) +},b.take=Ut,b.head=Ut,Ct(b,function(n,t){var r="sample"!==t;b.prototype[t]||(b.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new j(o,u):o})}),b.VERSION="2.4.1",b.prototype.chain=function(){return this.__chain__=true,this},b.prototype.toString=function(){return gr(this.__wrapped__)},b.prototype.value=ir,b.prototype.valueOf=ir,qt(["join","pop","shift"],function(n){var t=mr[n];b.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); +return n?new j(r,n):r}}),qt(["push","reverse","sort","unshift"],function(n){var t=mr[n];b.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),qt(["concat","slice","splice"],function(n){var t=mr[n];b.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments),this.__chain__)}}),b}var y,m=[],b=[],d=0,_=+new Date+"",w=75,j=40,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",x=/\b__p\+='';/g,C=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,E=/&(?:amp|lt|gt|quot|#39);/g,N=/[&<>"']/g,I=/<%-([\s\S]+?)%>/g,S=/<%([\s\S]+?)%>/g,T=/<%=([\s\S]+?)%>/g,A=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,R=/\w*$/,D=/^\s*function[ \n\r\t]+\w/,F=/^0[xX]/,$=/($^)/,B=/\bthis\b/,q=/['\n\r\t\u2028\u2029\\]/g,W="Array Boolean Date Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),z="[object Arguments]",P="[object Array]",K="[object Boolean]",L="[object Date]",M="[object Function]",V="[object Number]",U="[object Object]",X="[object RegExp]",G="[object String]",H={}; +H[M]=false,H[z]=H[P]=H[K]=H[L]=H[V]=H[U]=H[X]=H[G]=true;var J={leading:false,maxWait:0,trailing:false},Q={configurable:false,enumerable:false,value:null,writable:false},Y={"&":"&","<":"<",">":">",'"':""","'":"'"},Z={"&":"&","<":"<",">":">",""":'"',"'":"'"},nt={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},tt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},rt=nt[typeof window]&&window||this,et=nt[typeof exports]&&exports&&!exports.nodeType&&exports,ut=nt[typeof global]&&global; +!ut||ut.global!==ut&&ut.window!==ut||(rt=ut);var ot=(ut=nt[typeof module]&&module&&!module.nodeType&&module)&&ut.exports===et&&et,it=g();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(rt._=it, define(function(){return it})):et&&ut?ot?(ut.exports=it)._=it:et._=it:rt._=it}).call(this); \ No newline at end of file diff --git a/lodash.js b/lodash.js index ea45e4593..4bb99ee7d 100644 --- a/lodash.js +++ b/lodash.js @@ -71,9 +71,6 @@ /** Used to detect hexadecimal string values */ var reHexPrefix = /^0[xX]/; - /** Used to match leading whitespace in strings */ - var reLeadingWhitespace = RegExp('^[' + whitespace + ']+'); - /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -443,6 +440,23 @@ return typeof value.toString != 'function' && typeof (value + '') == 'string'; } + /** + * Checks the given string to determine if the character at the specified + * index is whitespace. + * + * @private + * @param {string} string The string to inspect. + * @param {number} index The character index. + * @returns {boolean} Returns `true` if specifed character is whitespace, else `false`. + */ + function isWhitespaceAt(string, index) { + var c = string.charCodeAt(index); + return ( + (c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 || + (c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c == 12288 || c == 65279)) + ); + } + /** * Releases the given array back to the array pool. * @@ -1935,8 +1949,8 @@ return ''; } string = String(string); - while (whitespace.indexOf(string.charAt(++start)) > -1) { } - while (whitespace.indexOf(string.charAt(--end)) > -1) { } + while (++start < end && isWhitespaceAt(string, start)) { } + while (end-- && isWhitespaceAt(string, end)) { } return string.slice(start, end + 1); }; }