Skip to content

Commit abe2b88

Browse files
committed
update readme
1 parent 1f81871 commit abe2b88

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ The smallest and simplest binary heap priority queue in JavaScript.
44

55
```js
66
// create an empty priority queue
7-
var queue = new TinyQueue();
7+
let queue = new TinyQueue();
88

99
// add some items
1010
queue.push(7);
1111
queue.push(5);
1212
queue.push(10);
1313

1414
// remove the top item
15-
var top = queue.pop(); // returns 5
15+
let top = queue.pop(); // returns 5
1616

1717
// return the top item (without removal)
1818
top = queue.peek(); // returns 7
@@ -29,28 +29,25 @@ queue = new TinyQueue([{value: 5}, {value: 7}], function (a, b) {
2929
});
3030

3131
// turn a queue into a sorted array
32-
var array = [];
32+
const array = [];
3333
while (queue.length) array.push(queue.pop());
3434
```
3535

3636
For a faster number-based queue, see [flatqueue](https://github.com/mourner/flatqueue).
3737

3838
### Install
3939

40-
Install using NPM (`npm install tinyqueue`) or Yarn (`yarn add tinyqueue`), then:
40+
Install using NPM (`npm install tinyqueue`), then import as a module:
4141

4242
```js
43-
// import as an ES module
4443
import TinyQueue from 'tinyqueue';
45-
46-
// or require in Node / Browserify
47-
const TinyQueue = require('tinyqueue');
4844
```
4945

50-
Or use a browser build directly:
46+
Or use a browser build from a CDN:
5147

5248
```html
53-
<script src="https://unpkg.com/[email protected]/tinyqueue.min.js"></script>
49+
<script type="module">
50+
import TinyQueue from 'https://cdn.jsdelivr.net/npm/tinyqueue/+esm';
5451
```
5552
5653
### Thanks

0 commit comments

Comments
 (0)