« get me outta code hell

http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/crawl-itunes.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/crawl-itunes.js')
-rwxr-xr-xsrc/crawl-itunes.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/crawl-itunes.js b/src/crawl-itunes.js
index e6b63b3..ce9ebf9 100755
--- a/src/crawl-itunes.js
+++ b/src/crawl-itunes.js
@@ -109,7 +109,7 @@ async function crawl(
   return resultGroup
 }
 
-async function main(args) {
+async function main(args, shouldReturn = false) {
   let playlist
 
   try {
@@ -137,7 +137,12 @@ async function main(args) {
     }
   }
 
-  console.log(JSON.stringify(playlist, null, 2))
+  const str = JSON.stringify(playlist, null, 2)
+  if (shouldReturn) {
+    return str
+  } else {
+    console.log(str)
+  }
 }
 
 module.exports = {main, crawl}