diff --git a/build.js b/build.js index f7153b7a6..59f794aa0 100755 --- a/build.js +++ b/build.js @@ -979,7 +979,7 @@ // remove assignment and aliases var modified = getAliases(funcName).concat(funcName).reduce(function(result, otherName) { - return result.replace(RegExp('(?:\\n *//.*\\s*)* *lodash\\.' + otherName + ' *= *.+\\n'), ''); + return result.replace(RegExp('^(?: *//.*\\s*)* *lodash\\.' + otherName + ' *= *.+\\n', 'm'), ''); }, snippet); // replace with the modified snippet @@ -1593,6 +1593,12 @@ if (isLegacy) { dependencyMap.defer = _.without(dependencyMap.defer, 'bind'); } + if (isModern) { + dependencyMap.isEmpty = _.without(dependencyMap.isEmpty, 'isArguments'); + dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'isArguments'); + dependencyMap.keys = _.without(dependencyMap.keys, 'isArguments'); + dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); + } if (isUnderscore) { dependencyMap.contains = _.without(dependencyMap.contains, 'isString'); dependencyMap.countBy = _.without(dependencyMap.countBy, 'isEqual', 'keys'); @@ -1600,13 +1606,14 @@ dependencyMap.filter = _.without(dependencyMap.filter, 'isEqual'); dependencyMap.find = _.without(dependencyMap.find, 'isEqual', 'keys'); dependencyMap.groupBy = _.without(dependencyMap.groupBy, 'isEqual', 'keys'); - dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'forIn', 'isArguments'); dependencyMap.isEmpty = ['isArray', 'isString']; + dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'forIn', 'isArguments'); dependencyMap.map = _.without(dependencyMap.map, 'isEqual', 'keys'); dependencyMap.max = _.without(dependencyMap.max, 'isEqual', 'isString', 'keys'); dependencyMap.min = _.without(dependencyMap.min, 'isEqual', 'isString', 'keys'); dependencyMap.pick = _.without(dependencyMap.pick, 'forIn', 'isObject'); dependencyMap.reduce = _.without(dependencyMap.reduce, 'isEqual', 'keys'); + dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isEqual', 'isString'); dependencyMap.reject = _.without(dependencyMap.reject, 'isEqual', 'keys'); dependencyMap.some = _.without(dependencyMap.some, 'isEqual', 'keys'); dependencyMap.sortBy = _.without(dependencyMap.sortBy, 'isEqual', 'keys'); @@ -1620,7 +1627,11 @@ } } if (isModern || isUnderscore) { - dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isEqual', 'isString'); + dependencyMap.at = _.without(dependencyMap.at, 'isString'); + dependencyMap.forEach = _.without(dependencyMap.forEach, 'isArguments', 'isString'); + dependencyMap.forIn = _.without(dependencyMap.forIn, 'isArguments'); + dependencyMap.forOwn = _.without(dependencyMap.forOwn, 'isArguments'); + dependencyMap.toArray = _.without(dependencyMap.toArray, 'isString'); } // add method names explicitly @@ -1692,6 +1703,10 @@ source = source.replace(matchFunction(source, 'isPlainObject'), function(match) { return match.replace(/!getPrototypeOf.+?: */, ''); }); + + if (!isMobile) { + source = removeIsFunctionFallback(source); + } } if (isUnderscore) { // replace `_.assign` @@ -2405,8 +2420,8 @@ source = source .replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, '') .replace(/(?:\s*\/\/.*)*\n( *)each\(\['[\s\S]+?\n\1}.+/g, '') - .replace(/(?:\s*\/\/.*)*\s*lodash\.prototype.+\n/g, '') - .replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\).+\n/, ''); + .replace(/(?:\s*\/\/.*)*\s*lodash\.prototype.+/g, '') + .replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\).+/, ''); } // remove functions, variables, and snippets that the minifier may miss if (isRemoved(source, 'clone')) { diff --git a/dist/lodash.js b/dist/lodash.js index df6d47184..9b93eceb9 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -1548,12 +1548,6 @@ function isFunction(value) { return typeof value == 'function'; } - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return value instanceof Function || toString.call(value) == funcClass; - }; - } /** * Checks if `value` is the language type of Object. diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 21aa62038..c389ce17f 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,38 +4,37 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(i){function a(n){if(!n||typeof n!="object")return o;var t=n.valueOf,r=typeof t=="function"&&(r=Mt(t))&&Mt(r);if(r)n=n==r||Mt(n)==r&&!H(n);else{var e=o;!n||typeof n!="object"||H(n)?n=e:(t=n.constructor,!Y(t)||t instanceof t?(or(n,function(n,t){e=t}),n=e===o||Ut.call(n,e)):n=e)}return n}function F(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof F?(this.__wrapped__=n,void 0):new F(n)}function R(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||p);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(nr?0:r);++er?Yt(0,u+r):r)||0,typeof u=="number"?i=-1<(tt(n)?n.indexOf(t,r):yt(n,t,r)):ur(n,function(n){return++eu&&(u=i)}}else t=!t&&tt(n)?D:P(t,r),ur(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});return u}function pt(n,t,r,e){var u=3>arguments.length;if(t=P(t,e,4),fr(n)){var i=-1,f=n.length;for(u&&(r=n[++i]);++iarguments.length;if(typeof u!="number")var f=ar(n),u=f.length;return t=P(t,e,4),at(n,function(e,a,c){a=f?f[--u]:--u,r=i?(i=o,n[a]):t(r,n[a],a,c)}),r}function vt(n,t,r){var e;if(t=P(t,r),fr(n)){r=-1;for(var u=n.length;++rr?Yt(0,u+r):r||0)-1;else if(r)return e=dt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])yt(a,p))&&((r||c)&&a.push(p),f.push(e))}return f}function bt(n,t){return tr||Jt&&2/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:F}};var At={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b":">",'"':""","'":"'"},lr=W(cr),pr=T(At,{l:At.l.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),sr=T(At);return Y(/x/)&&(Y=function(n){return n instanceof Et||Ht.call(n)==A}),Nt&&f&&typeof setImmediate=="function"&&(jt=bt(setImmediate,i)),F.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},F.assign=pr,F.at=function(n){for(var t=-1,r=Tt.apply(Ft,V(arguments,1)),e=r.length,u=St(e);++tyt(a,c)){i&&a.push(c);for(var p=r;--p;)if(!(e[p]||(e[p]=R(t[p],0,100)))(c))continue n;f.push(c)}}return f},F.invert=W,F.invoke=function(n,t){var r=V(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=St(typeof o=="number"?o:0);return at(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},F.keys=ar,F.map=ct,F.max=lt,F.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+""; -return Ut.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},F.merge=rt,F.min=function(n,t,r){var e=1/0,u=e;if(!t&&fr(n)){r=-1;for(var o=n.length;++ryt(o,r,1))&&(u[r]=n) -}),u},F.once=function(n){var t,r;return function(){return t?r:(t=e,r=n.apply(this,arguments),n=u,r)}},F.pairs=function(n){for(var t=-1,r=ar(n),e=r.length,u=St(e);++tr?Yt(0,e+r):Zt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},F.mixin=xt,F.noConflict=function(){return i._=Dt,this},F.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+Kt(nr()*((+t||0)-n+1)) -},F.reduce=pt,F.reduceRight=st,F.result=function(n,t){var e=n?n[t]:r;return Y(e)?n[t]():e},F.runInContext=t,F.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ar(n).length},F.some=vt,F.sortedIndex=dt,F.template=function(n,t,u){var o=F.templateSettings;n||(n=""),u=sr({},u,o);var i,f=sr({},u.imports,o.imports),o=ar(f),f=et(f),a=0,c=u.interpolate||_,l="__p+='",c=qt((u.escape||_).source+"|"+c.source+"|"+(c===d?m:_).source+"|"+(u.evaluate||_).source+"|$","g");n.replace(c,function(t,r,u,o,f,c){return u||(u=o),l+=n.slice(a,c).replace(j,K),r&&(l+="'+__e("+r+")+'"),f&&(i=e,l+="';"+f+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),a=c+t.length,t -}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(i?l.replace(v,""):l).replace(g,"$1").replace(h,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Et(o,"return "+l).apply(r,f)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},F.unescape=function(n){return n==u?"":(n+"").replace(s,G)},F.uniqueId=function(n){var t=++c;return(n==u?"":n+"")+t -},F.all=ot,F.any=vt,F.detect=ft,F.foldl=pt,F.foldr=st,F.include=ut,F.inject=pt,ir(F,function(n,t){F.prototype[t]||(F.prototype[t]=function(){var t=[this.__wrapped__];return Vt.apply(t,arguments),n.apply(F,t)})}),F.first=gt,F.last=function(n,t,r){if(n){var e=0,o=n.length;if(typeof t!="number"&&t!=u){var i=o;for(t=P(t,r);i--&&t(n[i],i,n);)e++}else if(e=t,e==u||r)return n[o-1];return V(n,Yt(0,o-e))}},F.take=gt,F.head=gt,ir(F,function(n,t){F.prototype[t]||(F.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return t==u||r&&typeof t!="function"?e:new F(e)})}),F.VERSION="1.0.1",F.prototype.toString=function(){return this.__wrapped__+""},F.prototype.value=Ot,F.prototype.valueOf=Ot,ur(["join","pop","shift"],function(n){var t=Ft[n];F.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),ur(["push","reverse","sort","unshift"],function(n){var t=Ft[n];F.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ur(["concat","slice","splice"],function(n){var t=Ft[n];F.prototype[n]=function(){return new F(t.apply(this.__wrapped__,arguments)) -}}),F}var r,e=!0,u=null,o=!1,i=typeof exports=="object"&&exports,f=typeof module=="object"&&module&&module.exports==i&&module,a=typeof global=="object"&&global;a.global===a&&(n=a);var c=0,l={},p=30,s=/&(?:amp|lt|gt|quot|#39);/g,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,h=/(__e\(.*?\)|\b__t\))\+'';/g,y=/\w*$/,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,d=/<%=([\s\S]+?)%>/g,_=/($^)/,b=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="[object Arguments]",x="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Function]",k="[object Number]",E="[object Object]",N="[object RegExp]",$="[object String]",I={}; -I[A]=o,I[w]=I[x]=I[O]=I[S]=I[k]=I[E]=I[N]=I[$]=e;var q={"boolean":o,"function":e,object:e,number:o,string:o,undefined:o},B={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},F=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=F,define(function(){return F})):i?f?(f.exports=F)._=F:i._=F:n._=F})(this); \ No newline at end of file +;(function(n){function t(e){function o(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof o?(this.__wrapped__=n,void 0):new o(n)}function $(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||a);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1; +if(nr?0:r);++er?Jt(0,u+r):r)||0,typeof u=="number"?o=-1<(W(n)?n.indexOf(t,r):pt(n,t,r)):Zt(n,function(n){return++eu&&(u=i)}}else t=!t&&W(n)?I:F(t,r),Zt(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});return u}function it(n,t,r,e){var u=3>arguments.length;if(t=F(t,e,4),rr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=er(n),u=i.length;return t=F(t,e,4),et(n,function(e,f,a){f=i?i[--u]:--u,r=o?(o=!1,n[f]):t(r,n[f],f,a)}),r}function at(n,t,r){var e;if(t=F(t,r),rr(n)){r=-1;for(var u=n.length;++rr?Jt(0,u+r):r||0)-1;else if(r)return e=vt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])pt(f,l))&&((r||a)&&f.push(l),i.push(e))}return i}function ht(n,t){return Wt||Mt&&2/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:h,variable:"",imports:{_:o}};var jt={a:"q,w,h",l:"var a=arguments,b=0,c=typeof h=='number'?2:a.length;while(++b":">",'"':""","'":"'"},or=G(ur),ir=R(jt,{l:jt.l.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=f(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),h:"u[j]=d?d(u[j],n[j]):n[j]"}),fr=R(jt),ar=function(n){if(!n||typeof n!="object")return!1;var t=n.valueOf,r=typeof t=="function"&&(r=zt(t))&&zt(r);if(r)n=n==r||zt(n)==r&&!K(n);else{var e=!1;!n||typeof n!="object"||K(n)?n=e:(t=n.constructor,!J(t)||t instanceof t?(nr(n,function(n,t){e=t +}),n=!1===e||Ct.call(n,e)):n=e)}return n};return Ot&&u&&typeof setImmediate=="function"&&(yt=ht(setImmediate,e)),o.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},o.assign=ir,o.at=function(n){for(var t=-1,r=Rt.apply(Nt,P(arguments,1)),e=r.length,u=bt(e);++tpt(a,c)){i&&a.push(c);for(var p=r;--p;)if(!(e[p]||(e[p]=$(t[p],0,100)))(c))continue n;f.push(c)}}return f},o.invert=G,o.invoke=function(n,t){var r=P(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=bt(typeof o=="number"?o:0); +return et(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=er,o.map=ut,o.max=ot,o.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return Ct.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},o.merge=X,o.min=function(n,t,r){var e=1/0,u=e;if(!t&&rr(n)){r=-1;for(var o=n.length;++rpt(o,r,1))&&(u[r]=n)}),u},o.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},o.pairs=function(n){for(var t=-1,r=er(n),e=r.length,u=bt(e);++tr?Jt(0,e+r):Lt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=dt,o.noConflict=function(){return e._=It,this},o.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Dt(Qt()*((+t||0)-n+1))},o.reduce=it,o.reduceRight=ft,o.result=function(n,t){var e=n?n[t]:r;return J(e)?n[t]():e},o.runInContext=t,o.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:er(n).length},o.some=at,o.sortedIndex=vt,o.template=function(n,t,e){var u=o.templateSettings; +n||(n=""),e=fr({},e,u);var i,f=fr({},e.imports,u.imports),u=er(f),f=Y(f),a=0,c=e.interpolate||y,v="__p+='",c=kt((e.escape||y).source+"|"+c.source+"|"+(c===h?g:y).source+"|"+(e.evaluate||y).source+"|$","g");n.replace(c,function(t,r,e,u,o,f){return e||(e=u),v+=n.slice(a,f).replace(d,D),r&&(v+="'+__e("+r+")+'"),o&&(i=!0,v+="';"+o+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),v+="';\n",c=e=e.variable,c||(e="obj",v="with("+e+"){"+v+"}"),v=(i?v.replace(l,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+e+"){"+(c?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}"; +try{var m=xt(u,"return "+v).apply(r,f)}catch(_){throw _.source=v,_}return t?m(t):(m.source=v,m)},o.unescape=function(n){return null==n?"":(n+"").replace(c,T)},o.uniqueId=function(n){var t=++i;return(null==n?"":n+"")+t},o.all=nt,o.any=at,o.detect=rt,o.foldl=it,o.foldr=ft,o.include=Z,o.inject=it,tr(o,function(n,t){o.prototype[t]||(o.prototype[t]=function(){var t=[this.__wrapped__];return Pt.apply(t,arguments),n.apply(o,t)})}),o.first=ct,o.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u; +for(t=F(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return P(n,Jt(0,u-e))}},o.take=ct,o.head=ct,tr(o,function(n,t){o.prototype[t]||(o.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return null==t||r&&typeof t!="function"?e:new o(e)})}),o.VERSION="1.0.1",o.prototype.toString=function(){return this.__wrapped__+""},o.prototype.value=_t,o.prototype.valueOf=_t,Zt(["join","pop","shift"],function(n){var t=Nt[n];o.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),Zt(["push","reverse","sort","unshift"],function(n){var t=Nt[n];o.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Zt(["concat","slice","splice"],function(n){var t=Nt[n];o.prototype[n]=function(){return new o(t.apply(this.__wrapped__,arguments))}}),o}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,o=typeof global=="object"&&global;o.global===o&&(n=o);var i=0,f={},a=30,c=/&(?:amp|lt|gt|quot|#39);/g,l=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/\w*$/,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/<%=([\s\S]+?)%>/g,y=/($^)/,m=/[&<>"']/g,d=/['\n\r\t\u2028\u2029\\]/g,_="[object Arguments]",b="[object Array]",j="[object Boolean]",w="[object Date]",x="[object Number]",O="[object Object]",S="[object RegExp]",A="[object String]",k={"[object Function]":!1}; +k[_]=k[b]=k[j]=k[w]=k[x]=k[O]=k[S]=k[A]=!0;var E={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},N={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},$=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=$,define(function(){return $})):e?u?(u.exports=$)._=$:e._=$:n._=$})(this); \ No newline at end of file