npm install --save lines-unlines
;lines"one\ntwo\n"; // ["one","two"]unlines; // "one\ntwo\n"
For details, refer to the Haskell documentation.
Note in particular that
lines is not the same function as
_ => _.split("\n"), and
unlines is not the same as
_ => _.join("\n").
Note also that, strictly speaking, neither
unlines is the other's inverse, even though Hackage (as of 2019‑07‑26) says that "
unlines is an inverse operation to
unlines (lines "a") evaluates to
lines (unlines ["\n"]) evaluates to
npm run verify lints, builds and tests the package.
Test cases can be generated using GHCi* (Haskell's REPL, included in the Haskell Platform):
$ ghci Spec.hs *Main> spec lines ["", "one"] *Main> spec unlines [, ["one"]]
The output can then be pasted into
* If you have the Nix package manager, you can run
nix-shell to get a shell with
ghci on the path.