iotaledger / curl.lib.js

IOTA Proof-of-Work algorithm ported to Javascript to work in WebGL2-enabled browsers
GNU General Public License v3.0
37 stars 31 forks source link

Remove method uses wrong JS method #26

Open obany opened 6 years ago

obany commented 6 years ago

The library remove method uses unshift, which is for adding to a list.

https://github.com/iotaledger/curl.lib.js/blob/2da1de36123d89b0c7dcababe24f72828bc5f794/src/curl.lib.js#L168

This should be either be shift() if you are trying to remove the current job, or pop() if you are trying to remove the last added item.

laubsauger commented 6 years ago

That's right. Using the unshift-method without parameters just returns the last element of the array which is most likely not the intended behaviour here.