« get me outta code hell

Only run test script if pickers2 is main script - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2017-09-02 10:30:08 -0300
committerFlorrie <towerofnix@gmail.com>2017-09-02 10:30:08 -0300
commit57e7495b30eaf502289f919c336afaa2ee076f7e (patch)
tree0011f8a23854df8320abca7e8fe1412d16ce422b
parent1bf436eecf2a04e7df1b2a6a720d6ac1712bc0bb (diff)
Only run test script if pickers2 is main script
-rw-r--r--src/pickers2.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pickers2.js b/src/pickers2.js
index 81617a9..8acc994 100644
--- a/src/pickers2.js
+++ b/src/pickers2.js
@@ -96,7 +96,7 @@ const createOrderedPicker = playlist => {
 
 // Test script:
 
-{
+if (require.main === module) {
   const playlist = {items: [{x: 'A'}, {x: 'B'}, {x: 'C'}, {items: [{x: 'D-a'}, {x: 'D-b'}]}, {x: 'E'}]}
   const picker = createOrderedPicker(playlist)
   const hm = new HistoryManager(picker)