Skip to content

Commit ded92d4

Browse files
committed
simplify slightly
1 parent ce85dbb commit ded92d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ export default class TinyQueue {
2020
if (this.length === 0) return undefined;
2121

2222
const top = this.data[0];
23-
this.length--;
23+
const bottom = this.data.pop();
2424

25-
if (this.length > 0) {
26-
this.data[0] = this.data[this.length];
25+
if (this.length > 1) {
26+
this.data[0] = bottom;
2727
this._down(0);
2828
}
29-
this.data.pop();
29+
this.length--;
3030

3131
return top;
3232
}

0 commit comments

Comments
 (0)