@vadzim/js
v1.0.0
Published
A better `node -p`.
Downloads
17
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
js <javascript>stdin variable can be used to access input. $ is a synonym for stdin.
Examples
Using math
js 2+2Read a field from a JSON file
js stdin.version < package.jsonAdd a field to a JSON file on the fly
js '$.foo = "bar", $' < in.json > out.jsonPromises & streams are resolved automatically
js 'new Promise(resolve => require("http").get("http://google.com", resolve))'await can be used in the calculated expression if it is supported by node.
