From 079bd207c5c66f3821191528d7da5be28d72e929 Mon Sep 17 00:00:00 2001 From: Eli Flanagan Date: Fri, 27 Aug 2021 16:22:13 -0400 Subject: [PATCH] ingest JavaScript map to nu to md You can create JavaScript `Map`'s from arrays. When encoded as JSON they can be shared to nu and easily converted to markdown for documentation and the like. --- cool_oneliners/js_map_to_markdown.nu | 2 ++ sample_data/js_map.json | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 cool_oneliners/js_map_to_markdown.nu create mode 100644 sample_data/js_map.json diff --git a/cool_oneliners/js_map_to_markdown.nu b/cool_oneliners/js_map_to_markdown.nu new file mode 100644 index 0000000..7dafd1f --- /dev/null +++ b/cool_oneliners/js_map_to_markdown.nu @@ -0,0 +1,2 @@ +# Ingest JavaScript Map JSON into nu then to markdown +open ../sample_data/js_map.json | each { echo [[EspaƱol English]; [ $it.0 $it.1]] } | to md diff --git a/sample_data/js_map.json b/sample_data/js_map.json new file mode 100644 index 0000000..49cd833 --- /dev/null +++ b/sample_data/js_map.json @@ -0,0 +1,6 @@ +[ + ["cero", "zero"], + ["uno", "one"], + ["dos", "two"], + ["tres", "three"] +]