summaryrefslogtreecommitdiff
path: root/lib/internal/linkedlist.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-02-15 13:33:33 -0800
committerJames M Snell <jasnell@gmail.com>2017-02-22 08:55:50 -0800
commitd61a511728919c4833ba7717777af93f51aedbc8 (patch)
tree933dc8fec842982abd80a89c56ba6069479c69dd /lib/internal/linkedlist.js
parentca480719199d2ff38223aff8e301aced25d7e6f1 (diff)
downloadandroid-node-v8-d61a511728919c4833ba7717777af93f51aedbc8.tar.gz
android-node-v8-d61a511728919c4833ba7717777af93f51aedbc8.tar.bz2
android-node-v8-d61a511728919c4833ba7717777af93f51aedbc8.zip
lib: refactor internal/linkedlist
PR-URL: https://github.com/nodejs/node/pull/11406 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'lib/internal/linkedlist.js')
-rw-r--r--lib/internal/linkedlist.js21
1 files changed, 10 insertions, 11 deletions
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
+};