Skip to content

Commit e07f8ee

Browse files
committed
Adding Queue.of and bump 0.19.0
1 parent 0a11e3e commit e07f8ee

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
22

3-
## 0.19.0 (provisional)
3+
## 0.19.0
44

55
* Adding `StaticIntervalTree`.
66
* Adding `PointerVector`.
7+
* Adding `Queue.of`.
78
* Adding `Stack.of`.
89
* Improving `Vector` & `BitVector` reallocation performance.
910
* Improving `InvertedIndex` performance.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mnemonist",
3-
"version": "0.19.0-beta1",
3+
"version": "0.19.0",
44
"description": "Curated collection of data structures for the JavaScript language.",
55
"scripts": {
66
"lint": "eslint ./*.js ./utils ./test",

queue.js

+11
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ Queue.from = function(iterable) {
195195
return queue;
196196
};
197197

198+
/**
199+
* Static @.of function taking an abitrary number of arguments & converting it
200+
* into a queue.
201+
*
202+
* @param {...any} args
203+
* @return {Queue}
204+
*/
205+
Queue.of = function() {
206+
return Queue.from(arguments);
207+
};
208+
198209
/**
199210
* Exporting.
200211
*/

test/queue.js

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ describe('Queue', function() {
8888
assert.deepEqual(queue.toArray(), [1, 2, 3]);
8989
});
9090

91+
it('should be possible to create a queue from arbitrary arguments.', function() {
92+
var queue = Queue.of(1, 2, 3);
93+
94+
assert.deepEqual(queue.toArray(), [1, 2, 3]);
95+
});
96+
9197
it('should be possible to create a values iterator.', function() {
9298
var queue = Queue.from([1, 2, 3]);
9399

0 commit comments

Comments
 (0)