https://github.com/maxmellon/fx5
A CLI is a JSON5 processing tool by node.js
https://github.com/maxmellon/fx5
Last synced: about 1 year ago
JSON representation
A CLI is a JSON5 processing tool by node.js
- Host: GitHub
- URL: https://github.com/maxmellon/fx5
- Owner: MaxMEllon
- Created: 2018-04-04T11:31:17.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T23:02:24.000Z (about 8 years ago)
- Last Synced: 2025-03-17T03:21:28.637Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 39.1 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fx5
Installation
---
```
$ npm i -g @maxmellon/fx5
```
Usage
---
### example1
```bash
$ echo '{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
' | fx5 'x => x.menu.popup.menuitem'
```
```
[
{
"value": "New",
"onclick": "CreateNewDoc()"
},
{
"value": "Open",
"onclick": "OpenDoc()"
},
{
"value": "Close",
"onclick": "CloseDoc()"
}
]
```
### example2
```bash
$ echo '{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
' | fx5 'x => x.menu.popup.menuitem.reduce((acc, cur) => acc + cur.value + " ", "")'
```
```
New Open Close
```
### example3
- pipeline-operator
```bash
$ echo '{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
' | fx5 'x => x.menu |> Object.keys'
```
```
[
"id",
"value",
"popup"
]
```
Requirements
---
- node >= 9
Inspired
---
- **[antonmedv/fx](https://github.com/antonmedv/fx)**
Special Thanks!!!!