invertase / denque

The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries.
https://docs.page/invertase/denque
Apache License 2.0
354 stars 33 forks source link

Minor change to push API in README.md #19

Closed jhamberg closed 5 years ago

jhamberg commented 5 years ago

Push does not appear to accept many arguments, so numbers should be separately added in the example for new Denque(). This is a minor issue, but bothersome since it is the first example after quick start. Currently the example leads to this behavior:

var denque = new Denque();
denque.push(1, 2, 3);
denque.shift(); //1
denque.pop(); // undefined as 3 was never added

This issue is also reflected on https://www.npmjs.com/.

Salakar commented 5 years ago

Good spot, I'll merge this.

The push implementation should be changed though to support push(...items) - to match Array.push() behaviour - I will get it looked at as soon as I can as well.

Thank you!