Comparing version 0.0.7 to 0.0.8
@@ -202,2 +202,15 @@ (function( global ) { | ||
/* utility methods */ | ||
// empty out all values in cbuffer | ||
// default is to delete values, but if pass arg then will set all values to arg | ||
empty : function( arg ) { | ||
var i = 0; | ||
if ( arg == null ) { | ||
while( delete this.data[i], ++i < this.size ); | ||
} else { | ||
while( this.data[i] = arg, ++i < this.size ); | ||
} | ||
this.size = this.start = 0; | ||
this.end = this.length - 1; | ||
return this; | ||
}, | ||
// return first item in buffer | ||
@@ -204,0 +217,0 @@ first : function() { |
{ | ||
"name" : "CBuffer", | ||
"version" : "0.0.7", | ||
"version" : "0.0.8", | ||
"description" : "Circular Buffer JavaScript implementation", | ||
@@ -5,0 +5,0 @@ "homepage" : "http://github.com/trevnorris/cbuffer", |
@@ -41,2 +41,3 @@ ## JavaScript [Circular Buffer](http://en.wikipedia.org/wiki/Circular_buffer) Utility | ||
* empty() | ||
* first() | ||
@@ -43,0 +44,0 @@ * last() |
13907
418
48