https://github.com/coreh/js
A better `node -p`
https://github.com/coreh/js
Last synced: 11 months ago
JSON representation
A better `node -p`
- Host: GitHub
- URL: https://github.com/coreh/js
- Owner: coreh
- License: mit
- Created: 2013-04-22T21:47:37.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2021-09-06T06:44:30.000Z (almost 5 years ago)
- Last Synced: 2024-04-15T03:20:36.291Z (about 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# js
**js** is a a better alternative to `node -p`. It will automatically convert data from and to JSON string representations, and will automatically expose enviroment variables as globals preceded with `$`.
## Usage
```bash
js
```
## Examples
Using math
```bash
js 2+2
```
Read a field from a JSON file
```bash
js stdin.version < package.json
```
Add a field to a JSON file on the fly
```bash
js 'stdin.foo = "bar", stdin' < in.json > out.json
```