NodeJs heap-js module: Heap is not a constructor

I am trying to initialize a minimum heap/priority queue in my server.js using the head-js module (https://github.com/ignlg/heap-js). When I run my code, I receive the following error: TypeError: Heap is not a constructor However, according to the documentation, I am initializing the heap correctly, putting in a custom constructor as the parameter. Below is my code: Answer There’s a difference between using heap-js library in CommonJS and ES6 modules. When requireing (i.e. CommonJS) you need to destruct out the Heap class from the object returned, like so: Whereas, you have to do the opposite in ES6, as shown below: