circular-buffer
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "circular-buffer", | ||
"version": "1.0.2", | ||
"description": "A NodeJS simple circular buffer implementation supporting indexing ", | ||
"version": "1.0.3", | ||
"description": "A NodeJS simple circular buffer implementation supporting indexing", | ||
"main": "index.js", | ||
@@ -10,4 +10,4 @@ "scripts": { | ||
"devDependencies": { | ||
"mocha": "^2.2.4", | ||
"chai": "^2.2.0" | ||
"chai": "^4.2.0", | ||
"mocha": "^8.2.0" | ||
}, | ||
@@ -22,3 +22,3 @@ "repository": { | ||
], | ||
"author": "Tom Smeding <hallo@tomsmeding.nl> (http://tomsmeding.com)", | ||
"author": "Tom Smeding <tom.smeding@gmail.com> (https://tomsmeding.com)", | ||
"license": "ISC", | ||
@@ -25,0 +25,0 @@ "bugs": { |
@@ -10,3 +10,3 @@ # NodeJS Circular Buffer | ||
The implementation can function both as a queue (which it's most suited for), and as a (forgetful) stack. Queue functionality uses `enq()` and `deq()`; stack functionality uses `push()` and `pop()`. Values are enqueued at the front of the buffer and dequeued at the back of the buffer; pushing and popping is at the back of the buffer. Indexing is front-to-back: the last-enqueued item has lowest index, which is also the first-pushed item. | ||
The implementation can function both as a forgetful queue (which it's most suited for), and as a (forgetful) stack. Queue functionality uses `enq()` and `deq()`; stack functionality uses `push()` and `pop()`. Values are enqueued at the front of the buffer and dequeued at the back of the buffer; pushing and popping is at the back of the buffer. Indexing is front-to-back: the last-enqueued item has lowest index, which is also the first-pushed item. | ||
@@ -52,2 +52,8 @@ ## Usage | ||
- Dequeue an item from the back of the buffer; returns that item. Throws `RangeError` if the buffer is empty on invocation. | ||
- `push(value)` | ||
- Push `value` at the back of the buffer | ||
- `pop()` -> `value` | ||
- Equivalent to `deq()`. | ||
- `shift()` -> `value` | ||
- Removes an item from the front of the buffer; returns that item. Throws `RangeError` if the buffer is empty on invocation. | ||
- `get(idx)` -> `value` | ||
@@ -54,0 +60,0 @@ - Get the value at index `idx`. `0` is the front of the buffer (last-enqueued item, or first-pushed item), `buf.size()-1` is the back of the buffer. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10287
67
5