diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 3ee9a1697..031391f8c 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -5365,17 +5365,18 @@ * // => [1, 4, 5] */ function xor() { - var index = 0, - length = arguments.length, - result = arguments[0] || []; + var index = -1, + length = arguments.length; while (++index < length) { var array = arguments[index]; if (isArray(array) || isArguments(array)) { - result = baseUniq(baseDifference(result, array).concat(baseDifference(array, result))); + var result = result + ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) + : array; } } - return result; + return result || []; } /** diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 3eff6feef..286453787 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -45,12 +45,12 @@ if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,e,3);o--&&t(n[o return n},v.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Re(0,de((t-n)/(e||1)));for(var u=te(t);++re?Re(0,r+e):Fe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},v.mixin=Xt,v.noConflict=function(){return e._=ve,this},v.noop=Yt,v.now=fr,v.parseInt=cr,v.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=$e(),Fe(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):ct(n,t) -},v.reduce=Ft,v.reduceRight=Tt,v.result=function(n,t){if(n){var e=n[t];return xt(e)?n[t]():e}},v.runInContext=g,v.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Je(n).length},v.some=Lt,v.sortedIndex=Wt,v.template=function(n,t,e){var r=v.templateSettings;n=fe(n||""),e=tr({},e,r);var u,o=tr({},e.imports,r.imports),r=Je(o),o=Ot(o),i=0,l=e.interpolate||N,f="__p+='",l=le((e.escape||N).source+"|"+l.source+"|"+(l===A?O:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(P,a),e&&(f+="'+__e("+e+")+'"),l&&(u=true,f+="';"+l+";\n__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t +},v.xor=function(){for(var n=-1,t=arguments.length;++ne?Re(0,r+e):Fe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},v.mixin=Xt,v.noConflict=function(){return e._=ve,this},v.noop=Yt,v.now=fr,v.parseInt=cr,v.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=$e(),Fe(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):ct(n,t)},v.reduce=Ft,v.reduceRight=Tt,v.result=function(n,t){if(n){var e=n[t]; +return xt(e)?n[t]():e}},v.runInContext=g,v.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Je(n).length},v.some=Lt,v.sortedIndex=Wt,v.template=function(n,t,e){var r=v.templateSettings;n=fe(n||""),e=tr({},e,r);var u,o=tr({},e.imports,r.imports),r=Je(o),o=Ot(o),i=0,l=e.interpolate||N,f="__p+='",l=le((e.escape||N).source+"|"+l.source+"|"+(l===A?O:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(P,a),e&&(f+="'+__e("+e+")+'"),l&&(u=true,f+="';"+l+";\n__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t }),f+="';",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(x,""):f).replace(C,"$1").replace(E,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=ue(r,"return "+f).apply(h,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},v.unescape=function(n){return null==n?"":fe(n).replace(Xe,dt)},v.uniqueId=function(n){var t=++m;return fe(null==n?"":n)+t },v.all=It,v.any=Lt,v.detect=Dt,v.findWhere=Dt,v.foldl=Ft,v.foldr=Tt,v.include=St,v.inject=Ft,rr(v,function(n,t){v.prototype[t]||(v.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return Ce.apply(t,arguments),t=n.apply(v,t),e?new y(t,e):t})}),v.first=zt,v.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Re(0,u-r))},v.sample=function(n,t,e){return n&&typeof n.length!="number"?n=Ot(n):qe.unindexedChars&&Et(n)&&(n=n.split("")),null==t||e?n?n[ct(0,n.length-1)]:h:(n=$t(n),n.length=Fe(Re(0,t),n.length),n) },v.take=zt,v.head=zt,rr(v,function(n,t){var e="sample"!==t;v.prototype[t]||(v.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 y(o,u):o})}),v.VERSION="2.3.0",v.prototype.chain=function(){return this.__chain__=true,this},v.prototype.toString=function(){return fe(this.__wrapped__)},v.prototype.value=ne,v.prototype.valueOf=ne,Ze(["join","pop","shift"],function(n){var t=pe[n];v.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); diff --git a/dist/lodash.js b/dist/lodash.js index 17ece3301..43b99c5ea 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -5015,17 +5015,18 @@ * // => [1, 4, 5] */ function xor() { - var index = 0, - length = arguments.length, - result = arguments[0] || []; + var index = -1, + length = arguments.length; while (++index < length) { var array = arguments[index]; if (isArray(array) || isArguments(array)) { - result = baseUniq(baseDifference(result, array).concat(baseDifference(array, result))); + var result = result + ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) + : array; } } - return result; + return result || []; } /** diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 28eb0b7ff..1ee5cb186 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,49 +4,49 @@ * Build: `lodash modern -o ./dist/lodash.js` */ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++ei||typeof a=="undefined")return 1;if(ae?0:e);++r=_&&a===n,l=[];if(f){var p=o(r);p?(a=t,r=p):f=false}for(;++ua(r,p)&&l.push(p);return f&&c(r),l}function it(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r=_&&f===n,h=u||v?i():s; -if(v){var g=o(h);g?(f=t,h=g):(v=false,h=u?h:(l(h),s))}for(;++af(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function st(n){return function(t,e,r){var u={};e=Z.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++ra||typeof i=="undefined")return 1;if(ie?0:e);++r=_&&i===n,l=[];if(f){var p=o(r);p?(i=t,r=p):f=false}for(;++ui(r,p)&&l.push(p);return f&&c(r),l}function at(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r=_&&f===n,h=u||v?a():s; +if(v){var g=o(h);g?(f=t,h=g):(v=false,h=u?h:(l(h),s))}for(;++if(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function st(n){return function(t,e,r){var u={};e=Z.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Re(0,o+e):e)||0,We(n)?a=-1e?Re(0,o+e):e)||0,We(n)?i=-1o&&(o=i)}}else t=null==t&&Ct(n)?r:Z.createCallback(t,e,3),Rt(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Tt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=Z.createCallback(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oarguments.length;return t=Z.createCallback(t,r,4),At(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) +for(var i=n.length;++eo&&(o=a)}}else t=null==t&&Ct(n)?r:Z.createCallback(t,e,3),Rt(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Tt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=Z.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;return t=Z.createCallback(t,r,4),At(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) }),e}function Bt(n){var t=-1,e=n?n.length:0,r=ne(typeof e=="number"?e:0);return Rt(n,function(n){var e=ct(0,++t);r[t]=r[e],r[e]=n}),r}function Wt(n,t,e){var r;t=Z.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++er?Re(0,u+r):r||0}else if(r)return r=Kt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Pt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=Z.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t=v;m?(a&&(a=ye(a)),s=f,i=n.apply(l,o)):a||(a=je(r,v))}return m&&c?c=ye(c):c||t===h||(c=je(u,t)),e&&(m=true,i=n.apply(l,o)),!m||c||a||(o=l=null),i}}function Ht(n){if(!jt(n))throw new le;var t=p(arguments,1); -return je(function(){n.apply(v,t)},1)}function Jt(n){return n}function Qt(n,t){var e=n,r=!t||jt(e);t||(e=nt,t=n,n=Z),Rt(dt(t),function(u){var o=n[u]=t[u];r&&(e.prototype[u]=function(){var t=this.__wrapped__,r=[t];return we.apply(r,arguments),r=o.apply(n,r),t&&typeof t=="object"&&t===r?this:(r=new e(r),r.__chain__=this.__chain__,r)})})}function Xt(){}function Yt(n){return function(t){return t[n]}}function Zt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,A)):G;var ne=e.Array,te=e.Boolean,ee=e.Date,re=e.Function,ue=e.Math,oe=e.Number,ae=e.Object,ie=e.RegExp,fe=e.String,le=e.TypeError,ce=[],pe=ae.prototype,se=e._,ve=pe.toString,he=ie("^"+fe(ve).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ge=ue.ceil,ye=e.clearTimeout,me=ue.floor,_e=re.prototype.toString,be=he.test(be=ae.getPrototypeOf)&&be,de=pe.hasOwnProperty,we=ce.push,je=e.setTimeout,ke=ce.splice,xe=typeof(xe=X&&Q&&X.setImmediate)=="function"&&!he.test(xe)&&xe,Ce=function(){try{var n={},t=he.test(t=ae.defineProperty)&&t,e=t(n,n,n)&&t -}catch(r){}return e}(),Oe=he.test(Oe=ae.create)&&Oe,Ie=he.test(Ie=ne.isArray)&&Ie,Ne=e.isFinite,Se=e.isNaN,Ee=he.test(Ee=ae.keys)&&Ee,Re=ue.max,Ae=ue.min,De=e.parseInt,$e=ue.random,Te={};Te[$]=ne,Te[T]=te,Te[F]=ee,Te[B]=re,Te[q]=ae,Te[W]=oe,Te[z]=ie,Te[P]=fe,nt.prototype=Z.prototype;var Fe=Z.support={};Fe.funcDecomp=!he.test(e.a)&&E.test(s),Fe.funcNames=typeof re.name=="string",Z.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:Z}},Oe||(rt=function(){function n(){}return function(t){if(kt(t)){n.prototype=t; -var r=new n;n.prototype=null}return r||e.Object()}}());var Be=Ce?function(n,t){M.value=t,Ce(n,"__bindData__",M)}:Xt,We=Ie||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ve.call(n)==$||false},qe=Ee?function(n){return kt(n)?Ee(n):[]}:J,ze={"&":"&","<":"<",">":">",'"':""","'":"'"},Pe=wt(ze),Ke=ie("("+qe(Pe).join("|")+")","g"),Le=ie("["+qe(ze).join("")+"]","g"),Me=st(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),Ve=st(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t) -}),Ue=st(function(n,t,e){n[e]=t}),Ge=Dt;xe&&(Ht=function(n){if(!jt(n))throw new le;return xe.apply(e,arguments)});var He=he.test(He=ee.now)&&He||function(){return(new ee).getTime()},Je=8==De(d+"08")?De:function(n,t){return De(Ct(n)?n.replace(N,""):n,t||0)};return Z.after=function(n,t){if(!jt(t))throw new le;return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=H,Z.at=function(n){for(var t=arguments,e=-1,r=it(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=ne(t);++e=_&&o(r?e[r]:s))) -}var p=e[0],h=-1,g=p?p.length:0,y=[];n:for(;++h(m?t(m,v):f(s,v))){for(r=u,(m||s).push(v);--r;)if(m=a[r],0>(m?t(m,v):f(e[r],v)))continue n;y.push(v)}}for(;u--;)(m=a[u])&&c(m);return l(a),l(s),y},Z.invert=wt,Z.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=ne(typeof o=="number"?o:0);return Rt(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},Z.keys=qe,Z.map=Dt,Z.mapValues=function(n,t,e){var r={};return t=Z.createCallback(t,e,3),g(n,function(n,e,u){r[e]=t(n,e,u) -}),r},Z.max=$t,Z.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!jt(n))throw new le;return e.cache={},e},Z.merge=function(n){var t=arguments,e=2;if(!kt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3e?0:e);++t=v;m?(i&&(i=ye(i)),s=f,a=n.apply(l,o)):i||(i=je(r,v))}return m&&c?c=ye(c):c||t===h||(c=je(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Ht(n){if(!jt(n))throw new le;var t=p(arguments,1); +return je(function(){n.apply(v,t)},1)}function Jt(n){return n}function Qt(n,t){var e=n,r=!t||jt(e);t||(e=nt,t=n,n=Z),Rt(dt(t),function(u){var o=n[u]=t[u];r&&(e.prototype[u]=function(){var t=this.__wrapped__,r=[t];return we.apply(r,arguments),r=o.apply(n,r),t&&typeof t=="object"&&t===r?this:(r=new e(r),r.__chain__=this.__chain__,r)})})}function Xt(){}function Yt(n){return function(t){return t[n]}}function Zt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,A)):G;var ne=e.Array,te=e.Boolean,ee=e.Date,re=e.Function,ue=e.Math,oe=e.Number,ie=e.Object,ae=e.RegExp,fe=e.String,le=e.TypeError,ce=[],pe=ie.prototype,se=e._,ve=pe.toString,he=ae("^"+fe(ve).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ge=ue.ceil,ye=e.clearTimeout,me=ue.floor,_e=re.prototype.toString,be=he.test(be=ie.getPrototypeOf)&&be,de=pe.hasOwnProperty,we=ce.push,je=e.setTimeout,ke=ce.splice,xe=typeof(xe=X&&Q&&X.setImmediate)=="function"&&!he.test(xe)&&xe,Ce=function(){try{var n={},t=he.test(t=ie.defineProperty)&&t,e=t(n,n,n)&&t +}catch(r){}return e}(),Oe=he.test(Oe=ie.create)&&Oe,Ie=he.test(Ie=ne.isArray)&&Ie,Ne=e.isFinite,Se=e.isNaN,Ee=he.test(Ee=ie.keys)&&Ee,Re=ue.max,Ae=ue.min,De=e.parseInt,$e=ue.random,Te={};Te[$]=ne,Te[T]=te,Te[F]=ee,Te[B]=re,Te[q]=ie,Te[W]=oe,Te[z]=ae,Te[P]=fe,nt.prototype=Z.prototype;var Fe=Z.support={};Fe.funcDecomp=!he.test(e.a)&&E.test(s),Fe.funcNames=typeof re.name=="string",Z.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:Z}},Oe||(rt=function(){function n(){}return function(t){if(kt(t)){n.prototype=t; +var r=new n;n.prototype=null}return r||e.Object()}}());var Be=Ce?function(n,t){M.value=t,Ce(n,"__bindData__",M)}:Xt,We=Ie||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ve.call(n)==$||false},qe=Ee?function(n){return kt(n)?Ee(n):[]}:J,ze={"&":"&","<":"<",">":">",'"':""","'":"'"},Pe=wt(ze),Ke=ae("("+qe(Pe).join("|")+")","g"),Le=ae("["+qe(ze).join("")+"]","g"),Me=st(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),Ve=st(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t) +}),Ue=st(function(n,t,e){n[e]=t}),Ge=Dt;xe&&(Ht=function(n){if(!jt(n))throw new le;return xe.apply(e,arguments)});var He=he.test(He=ee.now)&&He||function(){return(new ee).getTime()},Je=8==De(d+"08")?De:function(n,t){return De(Ct(n)?n.replace(N,""):n,t||0)};return Z.after=function(n,t){if(!jt(t))throw new le;return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=H,Z.at=function(n){for(var t=arguments,e=-1,r=at(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=ne(t);++e=_&&o(r?e[r]:s))) +}var p=e[0],h=-1,g=p?p.length:0,y=[];n:for(;++h(m?t(m,v):f(s,v))){for(r=u,(m||s).push(v);--r;)if(m=i[r],0>(m?t(m,v):f(e[r],v)))continue n;y.push(v)}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},Z.invert=wt,Z.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=ne(typeof o=="number"?o:0);return Rt(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},Z.keys=qe,Z.map=Dt,Z.mapValues=function(n,t,e){var r={};return t=Z.createCallback(t,e,3),g(n,function(n,e,u){r[e]=t(n,e,u) +}),r},Z.max=$t,Z.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!jt(n))throw new le;return e.cache={},e},Z.merge=function(n){var t=arguments,e=2;if(!kt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3e?Re(0,r+e):Ae(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Z.mixin=Qt,Z.noConflict=function(){return e._=se,this},Z.noop=Xt,Z.now=He,Z.parseInt=Je,Z.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=$e(),Ae(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):ct(n,t) -},Z.reduce=Tt,Z.reduceRight=Ft,Z.result=function(n,t){if(n){var e=n[t];return jt(e)?n[t]():e}},Z.runInContext=s,Z.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:qe(n).length},Z.some=Wt,Z.sortedIndex=Kt,Z.template=function(n,t,e){var r=Z.templateSettings;n=fe(n||""),e=U({},e,r);var u,o=U({},e.imports,r.imports),r=qe(o),o=Ot(o),i=0,f=e.interpolate||S,l="__p+='",f=ie((e.escape||S).source+"|"+f.source+"|"+(f===I?x:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(R,a),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t +},Z.reduce=Tt,Z.reduceRight=Ft,Z.result=function(n,t){if(n){var e=n[t];return jt(e)?n[t]():e}},Z.runInContext=s,Z.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:qe(n).length},Z.some=Wt,Z.sortedIndex=Kt,Z.template=function(n,t,e){var r=Z.templateSettings;n=fe(n||""),e=U({},e,r);var u,o=U({},e.imports,r.imports),r=qe(o),o=Ot(o),a=0,f=e.interpolate||S,l="__p+='",f=ae((e.escape||S).source+"|"+f.source+"|"+(f===I?x:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(R,i),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t }),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(w,""):l).replace(j,"$1").replace(k,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=re(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Z.unescape=function(n){return null==n?"":fe(n).replace(Ke,mt)},Z.uniqueId=function(n){var t=++y;return fe(null==n?"":n)+t },Z.all=Nt,Z.any=Wt,Z.detect=Et,Z.findWhere=Et,Z.foldl=Tt,Z.foldr=Ft,Z.include=It,Z.inject=Tt,g(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return we.apply(t,arguments),t=n.apply(Z,t),e?new nt(t,e):t})}),Z.first=qt,Z.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=Z.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return p(n,Re(0,u-r))},Z.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=Ot(n)),null==t||e?n?n[ct(0,n.length-1)]:v:(n=Bt(n),n.length=Ae(Re(0,t),n.length),n) },Z.take=qt,Z.head=qt,g(Z,function(n,t){var e="sample"!==t;Z.prototype[t]||(Z.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 nt(o,u):o})}),Z.VERSION="2.3.0",Z.prototype.chain=function(){return this.__chain__=true,this},Z.prototype.toString=function(){return fe(this.__wrapped__)},Z.prototype.value=Zt,Z.prototype.valueOf=Zt,Rt(["join","pop","shift"],function(n){var t=ce[n];Z.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); diff --git a/lodash.js b/lodash.js index e37003790..004f95a54 100644 --- a/lodash.js +++ b/lodash.js @@ -5383,17 +5383,18 @@ * // => [1, 4, 5] */ function xor() { - var index = 0, - length = arguments.length, - result = arguments[0] || []; + var index = -1, + length = arguments.length; while (++index < length) { var array = arguments[index]; if (isArray(array) || isArguments(array)) { - result = baseUniq(baseDifference(result, array).concat(baseDifference(array, result))); + var result = result + ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) + : array; } } - return result; + return result || []; } /**