Created
April 22, 2022 01:59
-
-
Save whamtet/114980b6c625205458d0e8d02b917bb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/planck | |
(require '[planck.core :refer [*in* slurp]]) | |
(require '[clojure.string :as string]) | |
(defn replaces [s] | |
(reduce | |
(fn [s [k v]] | |
(string/replace s k v)) | |
s | |
{"Object {" "{" | |
"Array [" "["})) | |
(defn map-lines [f s] | |
(->> (.split s "\n") | |
(map f) | |
(string/join "\n"))) | |
(defn remove+- [s] | |
(let [s (.trim s)] | |
(if (or (.startsWith s "+") (.startsWith s "-")) | |
(.substring s 1) | |
s))) | |
(->> *in* | |
slurp | |
replaces | |
(map-lines remove+-) | |
println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment