diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 4c99181c8..71f427204 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -6415,18 +6415,10 @@ * // => { 'name': 'fred' } */ function omit(object, callback, thisArg) { - var result = {}, - type = typeof callback; + var result = {}; - if (type != 'function') { - // enables use as a callback for functions like `_.map` - // when combined with `_.partialRight` - var args = arguments; - if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) { - args = slice(args); - splice.call(args, 1, 2); - } - var omitProps = baseFlatten(args, true, false, 1), + if (typeof callback != 'function') { + var omitProps = baseFlatten(arguments, true, false, 1), length = omitProps.length; while (length--) { @@ -6511,19 +6503,11 @@ * // => { 'name': 'fred' } */ function pick(object, callback, thisArg) { - var result = {}, - type = typeof callback; + var result = {}; - if (type != 'function') { - // enables use as a callback for functions like `_.map` - // when combined with `_.partialRight` - var args = arguments; - if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) { - args = slice(args); - splice.call(args, 1, 2); - } + if (typeof callback != 'function') { var index = -1, - props = baseFlatten(args, true, false, 1), + props = baseFlatten(arguments, true, false, 1), length = isObject(object) ? props.length : 0; while (++index < length) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index becaa3d24..bbcaeff9d 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -47,9 +47,9 @@ return"boolean"!=u&&null!=t&&(e=r,r=t,t=false,"number"!=u&&"string"!=u||!e||e[r] for(t=H(t,r,3);u--&&(r=e[u],false!==t(n[r],r,n)););return n},u.functions=er,u.groupBy=ve,u.indexBy=ye,u.initial=function(n,t,r){var e=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=o;for(t=u.createCallback(t,r,3);a--&&t(n[a],a,n);)e++}else e=null==t||r?1:t||e;return e=o-e,qt(n,0,0=S&&ce(e?n[e]:l)))}var i=n[0],p=-1,g=i?i.length:0,h=[]; n:for(;++p(v?r(v,f):a(l,f))){for(e=u,(v||l).push(f);--e;)if(v=o[e],0>(v?r(v,f):a(n[e],f)))continue n;h.push(f)}}return s(o),s(l),h},u.invert=function(n,t){for(var r=-1,e=we(n),u=e.length,o={};++rarguments.length&&be(n))for(;++r { 'name': 'fred' } */ function omit(object, callback, thisArg) { - var result = {}, - type = typeof callback; + var result = {}; - if (type != 'function') { - // enables use as a callback for functions like `_.map` - // when combined with `_.partialRight` - var args = arguments; - if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) { - args = slice(args); - splice.call(args, 1, 2); - } - var omitProps = baseFlatten(args, true, false, 1), + if (typeof callback != 'function') { + var omitProps = baseFlatten(arguments, true, false, 1), length = omitProps.length; while (length--) { @@ -6232,19 +6224,11 @@ * // => { 'name': 'fred' } */ function pick(object, callback, thisArg) { - var result = {}, - type = typeof callback; + var result = {}; - if (type != 'function') { - // enables use as a callback for functions like `_.map` - // when combined with `_.partialRight` - var args = arguments; - if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) { - args = slice(args); - splice.call(args, 1, 2); - } + if (typeof callback != 'function') { var index = -1, - props = baseFlatten(args, true, false, 1), + props = baseFlatten(arguments, true, false, 1), length = isObject(object) ? props.length : 0; while (++index < length) { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 7075038da..9224c344b 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -9,15 +9,15 @@ */ (function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202e||13e||8202r||13r||8202=A&&(o=r,e=ie(e));++uo(e,f)&&a.push(f)}return a}function ht(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(;++r=A&&(o=r,e=ie(e));++uo(e,f)&&a.push(f)}return a}function ht(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(;++r=A,l=[];if(f)var s=ie(),i=r;else s=u?c():l;for(;++oi(s,h))&&((u||f)&&s.push(h),l.push(g)) }return!f&&u&&p(s),l}function xt(n,t){return function(r,e,u){var o=t?[[],[]]:{};e=y.createCallback(e,u,3),u=-1;var i=r?r.length:0;if(typeof i=="number")for(;++ur&&(r=0),e=[n,t,r,e,u,o],t==w||t==(w|C)?S(e):pt(e)) }function Ot(){var n=(n=y.indexOf)===Rt?t:n;return n}function At(n){return typeof n=="function"&&Nr.test(Fr.call(n))}function St(n){var t,r;return n&&Er.call(n)==et&&(Br.call(n,"constructor")||(t=n.constructor,!er(t)||t instanceof t))?(o(n,function(n,t){r=t}),typeof r=="undefined"||Br.call(n,r)):false}function Et(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Er.call(n)==Q||false}function Nt(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,r,3);++oo&&(o=a)}else t=null==t&&ir(n)?e:y.createCallback(t,r,3),ht(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function Xt(n,t,r,e){var u=3>arguments.length;t=y.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=y.createCallback(t,e,4),vt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Ht(n){var t=-1,r=n?n.length:0,e=hr(typeof r=="number"?r:0); -return ht(n,function(n){var r=kt(0,++t);e[t]=e[r],e[r]=n}),e}function Jt(n,t,r){var e;t=y.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"){for(;++rarguments.length)return Ct(n,w,null,t);if(n)var r=n[N]?n[N][2]:n.length,e=Tt(arguments,2),r=r-e.length;return Ct(n,w|C,r,t,e)}function Yt(n,t,r){function e(){c&&Ir(c),i=c=p=_,(h||g!==t)&&(s=de(),a=n.apply(l,o),c||i||(o=l=null)) -}function u(){var r=t-(de()-f);0=y;m?(i&&(i=Ir(i)),s=f,a=n.apply(l,o)):i||(i=Wr(e,y))}return m&&c?c=Ir(c):c||t===g||(c=Wr(u,t)),r&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a +return ht(n,function(n){var r=kt(0,++t);e[t]=e[r],e[r]=n}),e}function Jt(n,t,r){var e;t=y.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"){for(;++rarguments.length)return Ct(n,w,null,t);if(n)var r=n[N]?n[N][2]:n.length,e=Tt(arguments,2),r=r-e.length;return Ct(n,w|C,r,t,e)}function Yt(n,t,r){function e(){c&&Ir(c),i=c=p=_,(h||g!==t)&&(s=be(),a=n.apply(l,o),c||i||(o=l=null)) +}function u(){var r=t-(be()-f);0=y;m?(i&&(i=Ir(i)),s=f,a=n.apply(l,o)):i||(i=Wr(e,y))}return m&&c?c=Ir(c):c||t===g||(c=Wr(u,t)),r&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a }}function Zt(n,t,r){var e=arguments,u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3--n?t.apply(this,arguments):void 0}},y.assign=Zt,y.at=function(n,t){var r=arguments,e=-1,u=mt(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),r=hr(o);++e--n?t.apply(this,arguments):void 0}},y.assign=Zt,y.at=function(n,t){var r=arguments,e=-1,u=mt(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),r=hr(o);++earguments.length?Ct(t,w|k,null,n):Ct(t,w|k|C,null,n,Tt(arguments,2))},y.chain=function(n){return n=new m(n),n.__chain__=true,n},y.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t=A&&ie(e?n[e]:f)))}var a=n[0],s=-1,g=a?a.length:0,h=[]; n:for(;++s(v?r(v,l):i(f,l))){for(e=u,(v||f).push(l);--e;)if(v=o[e],0>(v?r(v,l):i(n[e],l)))continue n;h.push(l)}}return p(o),p(f),h},y.invert=function(n,t){for(var r=-1,e=ve(n),u=e.length,o={};++rarguments.length&&typeof u=="number")for(;++rr?Hr(0,e+r):Jr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},y.mixin=pr,y.noConflict=function(){return n._=Sr,this},y.noop=sr,y.now=de,y.parseInt=_e,y.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=Zr(),Jr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):kt(n,t) -},y.reduce=Xt,y.reduceRight=Gt,y.result=function(n,t,r){var e=null==n?_:n[t];return typeof e=="undefined"?r:er(e)?n[t]():e},y.runInContext=d,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ve(n).length},y.some=Jt,y.sortedIndex=Ft,y.template=function(n,t,r){var e=y.templateSettings;n=kr(n||""),r=nr({},r,e);var u,o=nr({},r.imports,e.imports),e=ve(o),o=ar(o),i=0,a=r.interpolate||M,f="__p+='",a=wr((r.escape||M).source+"|"+a.source+"|"+(a===W?z:M).source+"|"+(r.evaluate||M).source+"|$","g"); +},y.cloneDeep=function(n,t,r){return G(n,true,typeof t=="function"&&ct(t,r,1))},y.contains=Wt,y.escape=function(n){return null==n?"":kr(n).replace(B,f)},y.every=zt,y.find=Pt,y.findIndex=function(n,t,r){var e=-1,u=n?n.length:0;for(t=y.createCallback(t,r,3);++er?Hr(0,e+r):Jr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},y.mixin=pr,y.noConflict=function(){return n._=Sr,this},y.noop=sr,y.now=be,y.parseInt=_e,y.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=Zr(),Jr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):kt(n,t) +},y.reduce=Xt,y.reduceRight=Gt,y.result=function(n,t,r){var e=null==n?_:n[t];return typeof e=="undefined"?r:er(e)?n[t]():e},y.runInContext=b,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ve(n).length},y.some=Jt,y.sortedIndex=Ft,y.template=function(n,t,r){var e=y.templateSettings;n=kr(n||""),r=nr({},r,e);var u,o=nr({},r.imports,e.imports),e=ve(o),o=ar(o),i=0,a=r.interpolate||M,f="__p+='",a=wr((r.escape||M).source+"|"+a.source+"|"+(a===W?z:M).source+"|"+(r.evaluate||M).source+"|$","g"); n.replace(a,function(t,r,e,o,a,c){return e||(e=o),f+=n.slice(i,c).replace(V,l),r&&(f+="'+__e("+r+")+'"),a&&(u=true,f+="';"+a+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';",a=r=r.variable,a||(r="obj",f="with("+r+"){"+f+"}"),f=(u?f.replace(I,""):f).replace(T,"$1").replace(F,"$1;"),f="function("+r+"){"+(a?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=mr(e,"return "+f).apply(_,o) -}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.trim=ye,y.trimLeft=me,y.trimRight=be,y.unescape=function(n){return null==n?"":(n=kr(n),0>n.indexOf(";")?n:n.replace($,b))},y.uniqueId=function(n){var t=++R;return kr(null==n?"":n)+t},y.all=zt,y.any=Jt,y.detect=Pt,y.findWhere=Pt,y.foldl=Xt,y.foldr=Gt,y.include=Wt,y.inject=Xt,pr(function(){var n={};return bt(y,function(t,r){y.prototype[r]||(n[r]=t)}),n}(),false),y.first=Nt,y.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u; -for(t=y.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:_;return e=u-e,Tt(n,0n.indexOf(";")?n:n.replace($,d))},y.uniqueId=function(n){var t=++R;return kr(null==n?"":n)+t},y.all=zt,y.any=Jt,y.detect=Pt,y.findWhere=Pt,y.foldl=Xt,y.foldr=Gt,y.include=Wt,y.inject=Xt,pr(function(){var n={};return dt(y,function(t,r){y.prototype[r]||(n[r]=t)}),n}(),false),y.first=Nt,y.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u; +for(t=y.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:_;return e=u-e,Tt(n,0"']/g,D=/<%-([\s\S]+?)%>/g,q=/<%([\s\S]+?)%>/g,W=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,L=/\w*$/,P=/^\s*function[ \n\r\t]+\w/,K=/^0[xX]/,M=/($^)/,U=/\bthis\b/,V=/['\n\r\t\u2028\u2029\\]/g,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",G=[],H=[],J="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Q="[object Arguments]",Y="[object Array]",Z="[object Boolean]",nt="[object Date]",tt="[object Function]",rt="[object Number]",et="[object Object]",ut="[object RegExp]",ot="[object String]",it={}; it[tt]=false,it[Q]=it[Y]=it[Z]=it[nt]=it[rt]=it[et]=it[ut]=it[ot]=true;var at={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},lt={"&":"&","<":"<",">":">",'"':""","'":"'"},ct={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={"function":true,object:true},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},gt=pt[typeof window]&&window||this,ht=pt[typeof exports]&&exports&&!exports.nodeType&&exports,pt=pt[typeof module]&&module&&!module.nodeType&&module,vt=ht&&pt&&typeof global=="object"&&global; -!vt||vt.global!==vt&&vt.window!==vt&&vt.self!==vt||(gt=vt);var vt=pt&&pt.exports===ht&&ht,yt=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gt._=yt, define(function(){return yt})):ht&&pt?vt?(pt.exports=yt)._=yt:ht._=yt:gt._=yt}).call(this); \ No newline at end of file +!vt||vt.global!==vt&&vt.window!==vt&&vt.self!==vt||(gt=vt);var vt=pt&&pt.exports===ht&&ht,yt=b();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gt._=yt, define(function(){return yt})):ht&&pt?vt?(pt.exports=yt)._=yt:ht._=yt:gt._=yt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 9d93d9a0d..fe6570865 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -4313,16 +4313,9 @@ * // => { 'name': 'fred' } */ function omit(object, guard) { - var args = arguments, - result = {}, - type = typeof guard; - - if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === object) { - args = slice(args); - splice.call(args, 1, 2); - } - var omitProps = baseFlatten(args, true, false, 1), - length = omitProps.length; + var omitProps = baseFlatten(arguments, true, false, 1), + length = omitProps.length, + result = {}; while (length--) { omitProps[length] = String(omitProps[length]); @@ -4397,16 +4390,9 @@ * }); * // => { 'name': 'fred' } */ - function pick(object, guard) { - var args = arguments, - type = typeof guard; - - if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === object) { - args = slice(args); - splice.call(args, 1, 2); - } + function pick(object) { var index = -1, - props = baseFlatten(args, true, false, 1), + props = baseFlatten(arguments, true, false, 1), length = props.length, result = {}; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 5544cb9d8..0f0e50b5b 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -5,36 +5,36 @@ */ ;(function(){function n(n){var r=[];if(!L(n))return r;for(var t in n)Ur.call(n,t)&&r.push(t);return r}function r(n,r){if(L(n))for(var t in n)if(r(n[t],t,n)===sr)break}function t(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(te(r,i)&&o.push(i)}return o}function v(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(;++te(r,i)&&o.push(i)}return o}function h(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(;++tu(f,l))&&(t&&f.push(l),i.push(a))}return i}function _(n){return function(r,t,e){var u={};t=Z(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++eu(f,l))&&(t&&f.push(l),i.push(a))}return i}function _(n){return function(r,t,e){var u={};t=Z(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++et&&(t=0),n=[n,r,t,e,u,o],r==or||r==(or|lr)?l(n):s(n)}function w(){var n=(n=f.indexOf)===A?t:n;return n}function j(n){return typeof n=="function"&&Wr.test(Pr.call(n))}function x(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Dr.call(n)==br||false}function T(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=Z(r,t,3);++oe?Yr(0,u+e):e||0;else if(e)return e=k(n,r),u&&n[e]===r?e:-1;return t(n,r,e)}function E(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=Z(r,t,3);++ur?r=Yr(u+r,0):r>u&&(r=u),typeof t=="undefined"?t=u:0>t?t=Yr(u+t,0):t>u&&(t=u),u=t-r||0,t=Array(u);++e>>1,t(n[e])u&&(u=t);else r=Z(r,t,3),v(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function M(n,r,t,e){var u=3>arguments.length;r=Z(r,e,4);var o=-1,i=n?n.length:0; -if(typeof i=="number")for(u&&i&&(t=n[++o]);++oarguments.length;return r=Z(r,e,4),h(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function W(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return v(n,function(n){var t;t=++r,t=0+Cr(rt()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function z(n,r,t){var e;r=Z(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"){for(;++targuments.length)return d(n,or,null,r);if(n)var t=n[pr]?n[pr][2]:n.length,e=O(arguments,2),t=t-e.length;return d(n,or|lr,t,r,e)}function U(n,r,t){function e(){c&&clearTimeout(c),i=c=p=ur,(v||g!==r)&&(s=lt(),f=n.apply(l,o),c||i||(o=l=null))}function u(){var t=r-(lt()-a);0=y;m?(i&&(i=clearTimeout(i)),s=a,f=n.apply(l,o)):i||(i=setTimeout(e,y))}return m&&c?c=clearTimeout(c):c||r===g||(c=setTimeout(u,r)),t&&(m=true,f=n.apply(l,o)),!m||c||i||(o=l=null),f}}function V(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t; +return t}function k(n,r,t,e){var u=0,o=n?n.length:u;for(t=t?Z(t,e,1):nr,r=t(r);u>>1,t(n[e])u&&(u=t);else r=Z(r,t,3),h(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function M(n,r,t,e){var u=3>arguments.length;r=Z(r,e,4);var o=-1,i=n?n.length:0; +if(typeof i=="number")for(u&&i&&(t=n[++o]);++oarguments.length;return r=Z(r,e,4),v(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function W(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return h(n,function(n){var t;t=++r,t=0+Cr(rt()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function z(n,r,t){var e;r=Z(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number"){for(;++targuments.length)return d(n,or,null,r);if(n)var t=n[pr]?n[pr][2]:n.length,e=O(arguments,2),t=t-e.length;return d(n,or|lr,t,r,e)}function U(n,r,t){function e(){c&&clearTimeout(c),i=c=p=ur,(h||g!==r)&&(s=lt(),f=n.apply(l,o),c||i||(o=l=null))}function u(){var t=r-(lt()-a);0=y;m?(i&&(i=clearTimeout(i)),s=a,f=n.apply(l,o)):i||(i=setTimeout(e,y))}return m&&c?c=clearTimeout(c):c||r===g||(c=setTimeout(u,r)),t&&(m=true,f=n.apply(l,o)),!m||c||i||(o=l=null),f}}function V(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t; for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,yr=/($^)/,mr=/['\n\r\t\u2028\u2029\\]/g,br="[object Arguments]",_r="[object Array]",dr="[object Boolean]",wr="[object Date]",jr="[object Number]",xr="[object Object]",Tr="[object RegExp]",Ar="[object String]",Er={"&":"&","<":"<",">":">",'"':""","'":"'"},Or={"&":"&","<":"<",">":">",""":'"',"'":"'"},kr={"function":true,object:true},Sr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Nr=kr[typeof window]&&window||this,qr=kr[typeof exports]&&exports&&!exports.nodeType&&exports,Fr=kr[typeof module]&&module&&!module.nodeType&&module,Br=qr&&Fr&&typeof global=="object"&&global; +var r=at(n);return function(t){for(var e=r.length,u=false;e--&&(u=r[e],u=Ur.call(t,u)&&t[u]===n[u]););return u}}function tr(n){for(var r=-1,t=H(n),e=t.length;++r"']/g,yr=/($^)/,mr=/['\n\r\t\u2028\u2029\\]/g,br="[object Arguments]",_r="[object Array]",dr="[object Boolean]",wr="[object Date]",jr="[object Number]",xr="[object Object]",Tr="[object RegExp]",Ar="[object String]",Er={"&":"&","<":"<",">":">",'"':""","'":"'"},Or={"&":"&","<":"<",">":">",""":'"',"'":"'"},kr={"function":true,object:true},Sr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Nr=kr[typeof window]&&window||this,qr=kr[typeof exports]&&exports&&!exports.nodeType&&exports,Fr=kr[typeof module]&&module&&!module.nodeType&&module,Br=qr&&Fr&&typeof global=="object"&&global; !Br||Br.global!==Br&&Br.window!==Br&&Br.self!==Br||(Nr=Br);var Rr=Fr&&Fr.exports===qr&&qr,$r=Array.prototype,Ir=Object.prototype,Mr=Nr._,Dr=Ir.toString,Wr=RegExp("^"+(Dr+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zr=Math.ceil,Cr=Math.floor,Pr=Function.prototype.toString,Ur=Ir.hasOwnProperty,Vr=$r.push,Gr=Ir.propertyIsEnumerable,Hr=$r.splice,Jr=j(Jr=Object.create)&&Jr,Kr=j(Kr=Array.isArray)&&Kr,Lr=Nr.isFinite,Qr=Nr.isNaN,Xr=j(Xr=Object.keys)&&Xr,Yr=Math.max,Zr=Math.min,nt=j(nt=Date.now)&&nt,rt=Math.random; a.prototype=f.prototype;var tt={};!function(){var n={0:1,length:1};tt.spliceObjects=(Hr.call(n,0,1),!n[0])}(1),f.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Jr||(c=function(){function n(){}return function(r){if(L(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Nr.Object()}}()),x(arguments)||(x=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ur.call(n,"callee")&&!Gr.call(n,"callee")||false});var et=_(function(n,r,t){Ur.call(n,t)?n[t]++:n[t]=1 }),ut=_(function(n,r,t){Ur.call(n,t)?n[t].push(r):n[t]=[r]}),ot=_(function(n,r,t){n[t]=r}),it=$,ft=Kr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Dr.call(n)==_r||false};K(/x/)&&(K=function(n){return typeof n=="function"&&"[object Function]"==Dr.call(n)});var at=Xr?function(n){return L(n)?Xr(n):[]}:n,lt=nt||function(){return(new Date).getTime()};f.after=function(n,r){if(!K(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},f.bind=P,f.bindAll=function(n){for(var r=1i(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},f.invert=function(n){for(var r=-1,t=at(n),e=t.length,u={};++rarguments.length&&typeof u=="number")for(;++tr?0:r);++nt?Yr(0,e+t):Zr(t,e-1))+1);e--;)if(n[e]===r)return e; -return-1},f.mixin=tr,f.noConflict=function(){return Nr._=Mr,this},f.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Cr(rt()*(r-n+1))},f.reduce=M,f.reduceRight=D,f.result=function(n,r){if(null!=n){var t=n[r];return K(t)?n[r]():t}},f.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:at(n).length},f.some=z,f.sortedIndex=k,f.template=function(n,r,t){var e=f,u=e.templateSettings;n=(n||"")+"",t=G({},t,u);var i=0,a="__p+='",u=t.variable;n.replace(RegExp((t.escape||yr).source+"|"+(t.interpolate||yr).source+"|"+(t.evaluate||yr).source+"|$","g"),function(r,t,e,u,f){return a+=n.slice(i,f).replace(mr,o),t&&(a+="'+_.escape("+t+")+'"),u&&(a+="';"+u+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),i=f+r.length,r -}),a+="';",u||(u="obj",a="with("+u+"||{}){"+a+"}"),a="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(e)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},f.unescape=function(n){return null==n?"":(n+="",0>n.indexOf(";")?n:n.replace(vr,i))},f.uniqueId=function(n){var r=++gr+"";return n?n+r:r},f.all=q,f.any=z,f.detect=B,f.findWhere=function(n,r){return C(n,r,true)},f.foldl=M,f.foldr=D,f.include=N,f.inject=M,f.first=T,f.last=function(n,r,t){var e=0,u=n?n.length:0; -if(typeof r!="number"&&null!=r){var o=u;for(r=Z(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:ur;return e=u-e,O(n,0r?0:r);++nt?Yr(0,e+t):Zr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},f.mixin=tr,f.noConflict=function(){return Nr._=Mr,this},f.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Cr(rt()*(r-n+1)) +},f.reduce=M,f.reduceRight=D,f.result=function(n,r){if(null!=n){var t=n[r];return K(t)?n[r]():t}},f.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:at(n).length},f.some=z,f.sortedIndex=k,f.template=function(n,r,t){var e=f,u=e.templateSettings;n=(n||"")+"",t=G({},t,u);var i=0,a="__p+='",u=t.variable;n.replace(RegExp((t.escape||yr).source+"|"+(t.interpolate||yr).source+"|"+(t.evaluate||yr).source+"|$","g"),function(r,t,e,u,f){return a+=n.slice(i,f).replace(mr,o),t&&(a+="'+_.escape("+t+")+'"),u&&(a+="';"+u+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),i=f+r.length,r +}),a+="';",u||(u="obj",a="with("+u+"||{}){"+a+"}"),a="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(e)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},f.unescape=function(n){return null==n?"":(n+="",0>n.indexOf(";")?n:n.replace(hr,i))},f.uniqueId=function(n){var r=++gr+"";return n?n+r:r},f.all=q,f.any=z,f.detect=B,f.findWhere=function(n,r){return C(n,r,true)},f.foldl=M,f.foldr=D,f.include=N,f.inject=M,f.first=T,f.last=function(n,r,t){var e=0,u=n?n.length:0; +if(typeof r!="number"&&null!=r){var o=u;for(r=Z(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:ur;return e=u-e,O(n,0 { 'name': 'fred' } */ function omit(object, callback, thisArg) { - var result = {}, - type = typeof callback; + var result = {}; - if (type != 'function') { - // enables use as a callback for functions like `_.map` - // when combined with `_.partialRight` - var args = arguments; - if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) { - args = slice(args); - splice.call(args, 1, 2); - } - var omitProps = baseFlatten(args, true, false, 1), + if (typeof callback != 'function') { + var omitProps = baseFlatten(arguments, true, false, 1), length = omitProps.length; while (length--) { @@ -6528,19 +6520,11 @@ * // => { 'name': 'fred' } */ function pick(object, callback, thisArg) { - var result = {}, - type = typeof callback; + var result = {}; - if (type != 'function') { - // enables use as a callback for functions like `_.map` - // when combined with `_.partialRight` - var args = arguments; - if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) { - args = slice(args); - splice.call(args, 1, 2); - } + if (typeof callback != 'function') { var index = -1, - props = baseFlatten(args, true, false, 1), + props = baseFlatten(arguments, true, false, 1), length = isObject(object) ? props.length : 0; while (++index < length) { diff --git a/test/test.js b/test/test.js index eb4b510bd..91d93f819 100644 --- a/test/test.js +++ b/test/test.js @@ -5807,18 +5807,6 @@ test('should coerce property names to strings', 1, function() { deepEqual(_.omit({ '0': 'a' }, 0), {}); }); - - test('should work when used as a callback for `_.map`', 2, function() { - var callback = _.partialRight(_.omit, 'a'), - objects = [{ '0': 0, 'a': 0 }, { '1': 1, 'a': 1 }], - actual = _.map(objects, callback), - expected = [{ '0': 0 }, { '1': 1 }]; - - deepEqual(actual, expected); - - actual = _.map({ '0': objects[0], '1': objects[1] }, callback); - deepEqual(actual, expected); - }); }('a', 'c')); /*--------------------------------------------------------------------------*/ @@ -6236,18 +6224,6 @@ test('should coerce property names to strings', 1, function() { deepEqual(_.pick({ '0': 'a', '1': 'b' }, 0), { '0': 'a' }); }); - - test('should work when used as a callback for `_.map`', 2, function() { - var callback = _.partialRight(_.pick, 'a'), - objects = [{ '0': 0, 'a': 0 }, { '1': 1, 'a': 1 }], - actual = _.map(objects, callback), - expected = [{ 'a': 0 }, { 'a': 1 }]; - - deepEqual(actual, expected); - - actual = _.map({ '0': objects[0], '1': objects[1] }, callback); - deepEqual(actual, expected); - }); }('a', 'c')); /*--------------------------------------------------------------------------*/