From d873890e467c1ab3e4d7fbf525430dc307df72b1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 12 Nov 2012 07:35:33 -0800 Subject: [PATCH] Remove alternative `_.where` for Underscore build. Former-commit-id: 4e42a26d4c16157957fa43dbb31ae9706e2641b8 --- build.js | 21 --------------------- lodash.underscore.min.js | 6 +++--- test/test-build.js | 4 ---- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/build.js b/build.js index 31b84aea6..954710747 100755 --- a/build.js +++ b/build.js @@ -1031,7 +1031,6 @@ dependencyMap.min = ['forEach', 'isArray']; dependencyMap.pick = []; dependencyMap.template = ['defaults', 'escape']; - dependencyMap.where = ['filter', 'forIn']; if (useUnderscoreClone) { dependencyMap.clone = ['assign', 'isArray']; @@ -1292,26 +1291,6 @@ ' }' ].join('\n')); - // replace `_.where` - source = source.replace(/^( *)function where[\s\S]+?\n\1}/m, [ - ' function where(collection, properties) {', - ' var props = [];', - ' forIn(properties, function(value, prop) {', - ' props.push(prop);', - ' });', - ' return filter(collection, function(object) {', - ' var length = props.length;', - ' while (length--) {', - ' var result = object[props[length]] === properties[props[length]];', - ' if (!result) {', - ' break;', - ' }', - ' }', - ' return !!result;', - ' });', - ' }' - ].join('\n')); - // replace `_.without` source = source.replace(/^( *)function without[\s\S]+?\n\1}/m, [ ' function without(array) {', diff --git a/lodash.underscore.min.js b/lodash.underscore.min.js index 57e24daf2..64fc8df10 100644 --- a/lodash.underscore.min.js +++ b/lodash.underscore.min.js @@ -27,6 +27,6 @@ null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+Y(ft()*((+t||0)-e+1))},n.range=funct function(e){var t=e?e.length:0;return"number"==typeof t?t:Ct(e).length},n.some=A,n.sortBy=function(e,t,n){var i=[],t=s(t,n);kt(e,function(e,n,r){i.push({a:t(e,n,r),b:n,c:e})}),e=i.length;for(i.sort(r);e--;)i[e]=i[e].c;return i},n.sortedIndex=P,n.tap=function(e,t){return t(e),e},n.template=function(e,t,r){e||(e="");var r=h({},r,n.templateSettings),i=0,s="__p += '",u=r.variable;e.replace(RegExp((r.escape||$).source+"|"+(r.interpolate||$).source+"|"+(r.evaluate||$).source+"|$","g"),function(t,n,r,u, a){s+=e.slice(i,a).replace(K,o),s+=n?"'+_['escape']("+n+")+'":u?"';"+u+";__p+='":r?"'+((__t=("+r+"))==null?'':__t)+'":"",i=a+t.length}),s+="';",u||(u="obj",s="with("+u+"||{}){"+s+"}"),s="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+s+"return __p}";try{var a=Function("_","return "+s)(n)}catch(f){throw f.source=s,f}return t?a(t):(a.source=s,a)},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function( ){var a=new Date,f=t-(a-u);return r=arguments,s=this,0>=f?(clearTimeout(o),u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r_(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return et.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?N(C(arguments,"length")):0,r=Array(n);++t_(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return et.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?N(C(arguments,"length")):0,r=Array(n);++t