Comparing version 0.0.9 to 0.0.10
@@ -86,2 +86,18 @@ (function( global ) { | ||
}, | ||
// rotate buffer to the left by cntr, or by 1 | ||
rotateLeft : function( cntr ) { | ||
if ( !cntr ) cntr = 1; | ||
while ( --cntr >= 0 ) { | ||
this.push( this.shift()); | ||
} | ||
return this; | ||
}, | ||
// rotate buffer to the right by cntr, or by 1 | ||
rotateRight : function( cntr ) { | ||
if ( !cntr ) cntr = 1; | ||
while ( --cntr >= 0 ) { | ||
this.unshift( this.pop()); | ||
} | ||
return this; | ||
}, | ||
// remove and return first item | ||
@@ -243,5 +259,5 @@ shift : function() { | ||
if ( module && module.exports ) module.exports = CBuffer; | ||
if ( typeof module === 'object' && module.exports ) module.exports = CBuffer; | ||
else global.CBuffer = CBuffer; | ||
}( this )); |
{ | ||
"name" : "CBuffer", | ||
"version" : "0.0.9", | ||
"version" : "0.0.10", | ||
"description" : "Circular Buffer JavaScript implementation", | ||
@@ -5,0 +5,0 @@ "homepage" : "http://github.com/trevnorris/cbuffer", |
@@ -24,2 +24,4 @@ ## JavaScript [Circular Buffer](http://en.wikipedia.org/wiki/Circular_buffer) Utility | ||
* reverse() | ||
* rotateLeft(x) | ||
* rotateRight(x) | ||
* shift() | ||
@@ -26,0 +28,0 @@ * sort() |
@@ -5,3 +5,3 @@ var vows = require( 'vows' ), | ||
require( '../env.js' ); | ||
require( '../env' ); | ||
@@ -8,0 +8,0 @@ suite.addBatch({ |
@@ -6,3 +6,3 @@ var vows = require( 'vows' ), | ||
require( '../env.js' ); | ||
require( '../env' ); | ||
@@ -9,0 +9,0 @@ suite.addBatch({ |
@@ -1,1 +0,1 @@ | ||
CBuffer = require( '../cbuffer.js' ); | ||
CBuffer = require( '../cbuffer' ); |
@@ -5,3 +5,3 @@ var vows = require( 'vows' ), | ||
require( '../env.js' ); | ||
require( '../env' ); | ||
@@ -8,0 +8,0 @@ suite.addBatch({ |
@@ -5,3 +5,3 @@ var vows = require( 'vows' ), | ||
require( '../env.js' ); | ||
require( '../env' ); | ||
@@ -8,0 +8,0 @@ suite.addBatch({ |
@@ -5,3 +5,3 @@ var vows = require( 'vows' ), | ||
require( '../env.js' ); | ||
require( '../env' ); | ||
@@ -8,0 +8,0 @@ suite.addBatch({ |
@@ -5,3 +5,3 @@ var vows = require( 'vows' ), | ||
require( '../env.js' ); | ||
require( '../env' ); | ||
@@ -8,0 +8,0 @@ suite.addBatch({ |
15355
15
467
50