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

.remove() fail to delete items when index < 0 #21

Closed lrills closed 5 years ago

lrills commented 5 years ago

Version: 1.4.0

Though it's not referenced on document, but nagative index seem to be supported according to: https://github.com/invertase/denque/blob/2a4fb0bc1bef9d84c4b6f2d460c140a776f03ae5/index.js#L215

Minimum steps to reproduce:

q = new Denque()
q.push(1) // 1
q.push(2) // 2
q.push(3) // 3
q.remove(-2,2) // [ 2, 3 ]

q.length // 3
Salakar commented 5 years ago

Forgot to reply here sorry, this is fixed and published to npm under version 1.4.1 now. Thanks.