-
Notifications
You must be signed in to change notification settings - Fork 12
Cookbook
Raine Virta edited this page Jun 1, 2015
·
40 revisions
Feel free to contribute to this document with ramda-cli snippets that have helped you.
- Create a markdown formatted table of Ramda's functions
- Merge JSON files into a single object
- Unwrap a list of objects into Line Delimited JSON
- Read filenames from stdin as an object of
{filename: body}
- Inspect MongoDB collection as a table
npm install -g markdown-table-cli
curl -s https://raine.github.io/ramda-json-docs/latest.json | \
R 'project <[ name sig category ]>' \
'map evolve sig: (-> it and "`#it`"), name: -> "[`#it`](http://ramdajs.com/docs/##it)"' \
| md-table
name | sig | category |
---|---|---|
add |
Number -> Number -> Number |
Math |
adjust |
(a -> a) -> Number -> [a] -> [a] |
List |
always |
a -> (* -> a) |
Function |
aperture |
Number -> [a] -> [[a]] |
List |
cat *.json | R --slurp merge-all
cat data.json | R --unslurp --compact identity
find . -name '*.txt' | R -r --slurp 'map -> (it): read-file it' merge-all
Install flat
to $HOME/node_modules
,
which is useful for flattening deep structures into a shallow object.
mongoexport -d test -c zips --jsonArray -q '{state: "NY"}' --sort '{pop: -1}' |\
R 'map require \flat' -o table | less
The result looks something like this: