Skip to content

Commit

Permalink
allow resetting of tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
bluesmoon committed Apr 11, 2012
1 parent 6ec439c commit dd049f9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions faststats.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ Stats.prototype = {
this._del_cache(tuple);
},

reset_tuples: function() {
var b, l;
if(!this.buckets) {
throw new Error("reset_tuple is only valid when using buckets");
}

for(b=0, l=this.buckets.length; b<l; i++) {
if(this.buckets[b] && this.buckets[b][0] > 0) {
this.buckets[b] = [this.buckets[b][0]];
}
else {
delete this.buckets[b];
}
}
}

unshift: function() {
var i, a, args=Array.prototype.slice.call(arguments, 0);
if(args.length && args[0] instanceof Array)
Expand Down

0 comments on commit dd049f9

Please sign in to comment.