aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-091/abigail/node/ch-1.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-091/abigail/node/ch-1.js b/challenge-091/abigail/node/ch-1.js
new file mode 100644
index 0000000000..898e085e2b
--- /dev/null
+++ b/challenge-091/abigail/node/ch-1.js
@@ -0,0 +1,15 @@
+//
+// Read STDIN. Split on newlines, filter out empty lines,
+// split each line on white space, then call "show"
+//
+ require ("fs")
+. readFileSync (0) // Read all.
+. toString () // Turn it into a string.
+. split ("\n") // Split on newlines.
+. filter (_ => _ . length) // Filter out empty lines.
+. map (_ => _ . replace (/([0-9])\1*/g,
+ (mtch, p1) => mtch . length + p1))
+ // Replace
+. map (_ => process . stdout . write (_ + "\n"))
+ // Print
+;