diff --git a/lib/internal/linkedlist.js b/lib/internal/linkedlist.js index 40bca91de2..a8cba6d009 100644 --- a/lib/internal/linkedlist.js +++ b/lib/internal/linkedlist.js @@ -4,7 +4,6 @@ function init(list) { list._idleNext = list; list._idlePrev = list; } -exports.init = init; // create a new linked list function create() { @@ -12,15 +11,12 @@ function create() { init(list); return list; } -exports.create = create; // show the most idle item function peek(list) { if (list._idlePrev === list) return null; return list._idlePrev; } -exports.peek = peek; - // remove the most idle item from the list function shift(list) { @@ -28,8 +24,6 @@ function shift(list) { remove(first); return first; } -exports.shift = shift; - // remove a item from its list function remove(item) { @@ -44,8 +38,6 @@ function remove(item) { item._idleNext = null; item._idlePrev = null; } -exports.remove = remove; - // remove a item from its list and place at the end. function append(list, item) { @@ -62,10 +54,17 @@ function append(list, item) { list._idleNext._idlePrev = item; list._idleNext = item; } -exports.append = append; - function isEmpty(list) { return list._idleNext === list; } -exports.isEmpty = isEmpty; + +module.exports = { + init, + create, + peek, + shift, + remove, + append, + isEmpty +};