underscore-keypath
Advanced tools
Comparing version 0.0.22 to 0.9.0
{ | ||
"name": "underscore-keypath", | ||
"version": "0.0.22", | ||
"version": "0.9.0", | ||
"homepage": "https://github.com/jeeeyul/underscore-keypath", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -321,4 +321,9 @@ (function () { | ||
return false; | ||
}, | ||
eachByKeyPath : function (arr, keyPath, interceptor) { | ||
underscore.chain(arr) | ||
.pluckByKeyPath(keyPath) | ||
.each(interceptor); | ||
} | ||
}; | ||
@@ -325,0 +330,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(){function a(a,b,c,d){return(0!==d?".":"")+b.replace(/\./g,"«dot»")}function b(b){"use strict";if("object"==typeof b&&"Array"===b.constructor.name)return Array.prototype.slice.call(b);if("string"==typeof b){b=b.replace(/\.\./g,"«dot»"),b=b.replace(/\['(([^']|\\')*)'\]/g,a),b=b.replace(/\["(([^"]|\\")*)"\]/g,a),b=b.replace(/([$A-Za-z_][0-9A-Za-z_$]*)\(\)/,"$1");var c=b.split(".");return c=j(c).map(function(a){return a.replace(/«dot»/g,".")})}throw new Error("keypath must be an array or a string")}function c(a){"use strict";return a=null===a?"":String(a),a.charAt(0).toUpperCase()+a.slice(1)}function d(a,b){"use strict";var c=l[b];return c?c(a):void 0}function e(a,b,c){"use strict";if(!(a instanceof Array))return void 0;var d=m[b];return d?d(a,c):void 0}function f(a,b){"use strict";if(""===b)return a;if(0===b.indexOf("@"))return d(a,b);var e=a["get"+c(b)];return void 0===e&&(e=a["is"+c(b)]),void 0===e&&(e=a[b]),"function"==typeof e&&(e=e.call(a)),e}function g(a,b){"use strict";return""===b?!0:"function"==typeof a["get"+c(b)]||"function"==typeof a["is"+c(b)]||j.has(a,b)}function h(a,b,d){"use strict";var f=a["set"+c(b)];return f?f.call(a,d):0===b.indexOf("@")?e(a,b,d):(a[b]=d,d)}function i(a,b){"use strict";var c,d,e=!0;for(c in b)if(b.hasOwnProperty(c)&&(d=b[c],j(a).valueForKeyPath(c)!==d)){e=!1;break}return e}var j;"undefined"!=typeof _&&(j=_);var k,l,m,n,o,p=this;if(k="undefined"!=typeof module&&"undefined"!=typeof require,"undefined"==typeof j&&(j=k?require("underscore"):p.underscore),"undefined"==typeof j)throw new Error("underscore.js is not found!");l={"@first":function(a){return j.first(a)},"@last":function(a){return j.last(a)},"@max":function(a){return j.max(a)},"@min":function(a){return j.min(a)},"@size":function(a){return j.size(a)}},m={"@first":function(a,b){return a[0]=b,b},"@last":function(a,b){return a[Math.max(a.length-1,0)]=b,b}},n={valueForKeyPath:function(a,c,d){"use strict";var e,g,h,i=a;if(null===a||void 0===a)return d;for(e=b(c),g=e.shift(),h=void 0;null!==i&&void 0!==i&&"string"==typeof g;)h=i,i=f(i,g),"function"==typeof i&&(i=i.call(h)),g=e.shift();return null===i||void 0===i?d:i},setValueForKeyPath:function(a,c,d){"use strict";var e,f,g=b(c);return e=g.pop(),f=j(a).valueForKeyPath(g.join(".")),null!==f&&void 0!==f?h(f,e,d):void 0},pluckByKeyPath:function(a,b){"use strict";var c,d,e=[];for(c=0;c<a.length;c+=1)d=a[c],e[c]=j(d).valueForKeyPath(b);return e},whereByKeyPath:function(a,b){"use strict";var c,d,e=[];for(c=0;c<a.length;c+=1)d=a[c],i(d,b)&&e.push(d);return e},findWhereByKeyPath:function(a,b){"use strict";var c,d;for(c=0;c<a.length;c+=1)if(d=a[c],i(d,b))return d;return null},sortByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.sortBy(a,b):j.sortBy(a,function(a){return j.valueForKeyPath(a,b)})},groupByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.groupBy(a,b):j.groupBy(a,function(a){return j.valueForKeyPath(a,b)})},indexByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.indexBy(a,b):j.indexBy(a,function(a){return j.valueForKeyPath(a,b)})},countByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.countBy(a,b):j.countBy(a,function(a){return j.valueForKeyPath(a,b)})},hasKeyPath:function(a,c){"use strict";var d,e,f;return null===a||void 0===a?!1:(d=b(c),e=d.pop(),f=this.valueForKeyPath(a,d),null!==f&&void 0!==f?g(f,e):!1)}},o={getValueForKeyPath:n.valueForKeyPath},j.mixin(n),j.mixin(o),k&&(module.exports=j,module.exports.__debug__={toSegments:b})}(); | ||
!function(){function a(a,b,c,d){return(0!==d?".":"")+b.replace(/\./g,"«dot»")}function b(b){"use strict";if("object"==typeof b&&"Array"===b.constructor.name)return Array.prototype.slice.call(b);if("string"==typeof b){b=b.replace(/\.\./g,"«dot»"),b=b.replace(/\['(([^']|\\')*)'\]/g,a),b=b.replace(/\["(([^"]|\\")*)"\]/g,a),b=b.replace(/([$A-Za-z_][0-9A-Za-z_$]*)\(\)/,"$1");var c=b.split(".");return c=j(c).map(function(a){return a.replace(/«dot»/g,".")})}throw new Error("keypath must be an array or a string")}function c(a){"use strict";return a=null===a?"":String(a),a.charAt(0).toUpperCase()+a.slice(1)}function d(a,b){"use strict";var c=l[b];return c?c(a):void 0}function e(a,b,c){"use strict";if(!(a instanceof Array))return void 0;var d=m[b];return d?d(a,c):void 0}function f(a,b){"use strict";if(""===b)return a;if(0===b.indexOf("@"))return d(a,b);var e=a["get"+c(b)];return void 0===e&&(e=a["is"+c(b)]),void 0===e&&(e=a[b]),"function"==typeof e&&(e=e.call(a)),e}function g(a,b){"use strict";return""===b?!0:"function"==typeof a["get"+c(b)]||"function"==typeof a["is"+c(b)]||j.has(a,b)}function h(a,b,d){"use strict";var f=a["set"+c(b)];return f?f.call(a,d):0===b.indexOf("@")?e(a,b,d):(a[b]=d,d)}function i(a,b){"use strict";var c,d,e=!0;for(c in b)if(b.hasOwnProperty(c)&&(d=b[c],j(a).valueForKeyPath(c)!==d)){e=!1;break}return e}var j;"undefined"!=typeof _&&(j=_);var k,l,m,n,o,p=this;if(k="undefined"!=typeof module&&"undefined"!=typeof require,"undefined"==typeof j&&(j=k?require("underscore"):p.underscore),"undefined"==typeof j)throw new Error("underscore.js is not found!");l={"@first":function(a){return j.first(a)},"@last":function(a){return j.last(a)},"@max":function(a){return j.max(a)},"@min":function(a){return j.min(a)},"@size":function(a){return j.size(a)}},m={"@first":function(a,b){return a[0]=b,b},"@last":function(a,b){return a[Math.max(a.length-1,0)]=b,b}},n={valueForKeyPath:function(a,c,d){"use strict";var e,g,h,i=a;if(null===a||void 0===a)return d;for(e=b(c),g=e.shift(),h=void 0;null!==i&&void 0!==i&&"string"==typeof g;)h=i,i=f(i,g),"function"==typeof i&&(i=i.call(h)),g=e.shift();return null===i||void 0===i?d:i},setValueForKeyPath:function(a,c,d){"use strict";var e,f,g=b(c);return e=g.pop(),f=j(a).valueForKeyPath(g.join(".")),null!==f&&void 0!==f?h(f,e,d):void 0},pluckByKeyPath:function(a,b){"use strict";var c,d,e=[];for(c=0;c<a.length;c+=1)d=a[c],e[c]=j(d).valueForKeyPath(b);return e},whereByKeyPath:function(a,b){"use strict";var c,d,e=[];for(c=0;c<a.length;c+=1)d=a[c],i(d,b)&&e.push(d);return e},findWhereByKeyPath:function(a,b){"use strict";var c,d;for(c=0;c<a.length;c+=1)if(d=a[c],i(d,b))return d;return null},sortByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.sortBy(a,b):j.sortBy(a,function(a){return j.valueForKeyPath(a,b)})},groupByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.groupBy(a,b):j.groupBy(a,function(a){return j.valueForKeyPath(a,b)})},indexByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.indexBy(a,b):j.indexBy(a,function(a){return j.valueForKeyPath(a,b)})},countByKeyPath:function(a,b){"use strict";return"string"!=typeof b?j.countBy(a,b):j.countBy(a,function(a){return j.valueForKeyPath(a,b)})},hasKeyPath:function(a,c){"use strict";var d,e,f;return null===a||void 0===a?!1:(d=b(c),e=d.pop(),f=this.valueForKeyPath(a,d),null!==f&&void 0!==f?g(f,e):!1)},eachByKeyPath:function(a,b,c){j.chain(a).pluckByKeyPath(b).each(c)}},o={getValueForKeyPath:n.valueForKeyPath},j.mixin(n),j.mixin(o),k&&(module.exports=j,module.exports.__debug__={toSegments:b})}(); | ||
//# sourceMappingURL=underscore-keypath.min.js.map |
Package.describe({ | ||
summary : "Keypath mechanism for underscore", | ||
git : "https://github.com/jeeeyul/underscore-keypath.git", | ||
version : "0.0.22" | ||
version : "0.9.0" | ||
}); | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name" : "underscore-keypath", | ||
"version" : "0.0.22", | ||
"version" : "0.9.0", | ||
@@ -6,0 +6,0 @@ "author" : "Jeeeyul Lee <jeeeyul@gmail.com>", |
# underscore-keypath | ||
[![Join the chat at https://gitter.im/jeeeyul/underscore-keypath](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jeeeyul/underscore-keypath?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Build Status](https://travis-ci.org/jeeeyul/underscore-keypath.png?branch=master)](https://travis-ci.org/jeeeyul/underscore-keypath) | ||
@@ -3,0 +5,0 @@ |
@@ -66,3 +66,3 @@ /* globals it:false, describe:false, it:false, before:false */ | ||
}); | ||
it("@max", function () { | ||
@@ -126,3 +126,1 @@ _.chain(fixture) | ||
}); | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
35024
26
854
86