0.3.0 • Published 5 years ago

unson v0.3.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

unson

CLI JSON processing tool harnessing the power of unmutable.

Installation

yarn

yarn global add unson

npm

npm install -g unson

Usage

Usage: unson [options] <pipeline>

Options:
  --version          Show version number                               [boolean]
  -i, --interactive  show interactive repl to write and edit pipeline  [boolean]
  -n, --indent       indent level for output json                       [number]
  -h, --help         Show help                                         [boolean]

unson drops you into an unmutable pipeWith function and all of the functions listed in the unmutable docs are available.

Examples

All the below examples use the data.json file as the data input.

// Get the max latitude
cat data.json | unson 'map(get("latitude")), max()'
// Group names by eye color
cat data.json | unson 'groupBy(get("eyeColor")), map(map(get("name")))'

Acknowledgements

Inspired by other CLI JSON processors like jq and (most notably) fx.

Uses editor-widget from slap-editor for the repl text editing.

js-playgrounds was a big help in the initial setup of editor-widget.