Permalink
Browse files

added sum to query

  • Loading branch information...
1 parent 8f8322c commit e71ed5e80b7afc9a76e6d9c379d7bf73f366d49b @bendangelo committed Jul 5, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/core/query.js
View
@@ -367,6 +367,15 @@
return val;
}
+
+ p.sum = function(method, context){
+ var val = 0;
+
+ this.each(function(e, i, l){
+ val += method.call(context || this, e, i, l);
+ });
+ return val;
+ }
//without this filter would return a normal array.
p.filter = function(){

0 comments on commit e71ed5e

Please sign in to comment.