Simple priority Queue implementation for NodeJS (Javascript)