mirror of https://github.com/antonmedv/fx
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
6 years ago | |
---|---|---|
.gitignore | 7 years ago | |
.travis.yml | 6 years ago | |
LICENSE | 7 years ago | |
README.md | 6 years ago | |
config.js | 6 years ago | |
docs.md | 6 years ago | |
fx.js | 6 years ago | |
index.js | 6 years ago | |
package.json | 6 years ago | |
print.js | 6 years ago | |
reduce.js | 6 years ago | |
test.js | 6 years ago |
README.md
* Function eXecution
Command-line JSON processing tool
Features
- Don't need to learn new syntax
- Plain JavaScript
- Formatting and highlighting
- Standalone binary
- Interactive mode 🎉
Install
$ npm install -g fx
Or via Homebrew
$ brew install fx
Or download standalone binary from releases page.
![](https://c5.patreon.com/external/logo/become_a_patron_button@2x.png)
Usage
Start interactive mode without passing any arguments.
$ curl ... | fx
Or by passing filename as first argument.
$ fx data.json
Pipe into fx
any JSON and anonymous function for reducing it.
$ curl ... | fx 'json => json.message'
Or same as above but short.
$ curl ... | fx this.message
$ curl ... | fx .message
Pass any numbers of arguments as code.
$ curl ... | fx 'json => json.message' 'json => json.filter(x => x.startsWith("a"))'
Access all lodash (or ramda, etc) methods by using .fxrc file.
$ curl ... | fx '_.mapValues(_.groupBy(this, "commit.committer.name"), _.size)'
Update JSON using spread operator.
$ echo '{"count": 0}' | fx '{...this, count: 1}'
{
"count": 1
}
Pretty print JSON with dot.
$ curl ... | fx .
Documentation
See full documentation.