We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 15f784e + 370848d commit 177d145Copy full SHA for 177d145
1 file changed
src/data-structures/linked-list.js
@@ -258,21 +258,19 @@
258
if (!this.first || !this.first.next) {
259
return;
260
}
261
- var current = this.first.next;
262
- var prev = this.first;
263
- var temp;
264
- while (current) {
265
- temp = current.next;
266
- current.next = prev;
267
- prev.prev = current;
268
- prev = current;
269
- current = temp;
270
- }
271
- this.first.next = null;
272
- this.last.prev = null;
273
- temp = this.first;
274
- this.first = prev;
275
- this.last = temp;
+ var current = this.first
+ var next
+
+ do {
+ next = current.next
+ current.next = current.prev
+ current.prev = next
+ current = next
+ } while (next)
+ var tmp = this.first
+ this.first = this.last
+ this.last = tmp
276
};
277
278
})(typeof window === 'undefined' ? module.exports : window);
0 commit comments