Skip to content

Commit

Permalink
Adding Queue.of and bump 0.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Mar 9, 2018
1 parent 0a11e3e commit e07f8ee
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## 0.19.0 (provisional)
## 0.19.0

* Adding `StaticIntervalTree`.
* Adding `PointerVector`.
* Adding `Queue.of`.
* Adding `Stack.of`.
* Improving `Vector` & `BitVector` reallocation performance.
* Improving `InvertedIndex` performance.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mnemonist",
"version": "0.19.0-beta1",
"version": "0.19.0",
"description": "Curated collection of data structures for the JavaScript language.",
"scripts": {
"lint": "eslint ./*.js ./utils ./test",
Expand Down
11 changes: 11 additions & 0 deletions queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ Queue.from = function(iterable) {
return queue;
};

/**
* Static @.of function taking an abitrary number of arguments & converting it
* into a queue.
*
* @param {...any} args
* @return {Queue}
*/
Queue.of = function() {
return Queue.from(arguments);
};

/**
* Exporting.
*/
Expand Down
6 changes: 6 additions & 0 deletions test/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ describe('Queue', function() {
assert.deepEqual(queue.toArray(), [1, 2, 3]);
});

it('should be possible to create a queue from arbitrary arguments.', function() {
var queue = Queue.of(1, 2, 3);

assert.deepEqual(queue.toArray(), [1, 2, 3]);
});

it('should be possible to create a values iterator.', function() {
var queue = Queue.from([1, 2, 3]);

Expand Down

0 comments on commit e07f8ee

Please sign in to comment.