{"name":"fx","version":"13.0.0","keywords":["json","viewer","cli","terminal","term","console","ascii","unicode","blessed"],"author":{"name":"Anton Medvedev","email":"anton@medv.io"},"license":"MIT","_id":"fx@13.0.0","maintainers":[{"name":"medv","email":"anton@medv.io"}],"homepage":"https://github.com/antonmedv/fx#readme","bugs":{"url":"https://github.com/antonmedv/fx/issues"},"bin":{"fx":"index.js"},"dist":{"shasum":"8fff8c0f76bc2af92c36a3f5c9e96d7e6e2707ce","tarball":"http://registry-npm.ywwl.com/fx/download/fx-13.0.0.tgz","fileCount":11,"integrity":"sha512-w7b8FJ8HwcU71K5lZjcPBsaSVnELNYOI9QvxyEuJ8h8aN8Q6/FBF3ehyeYNvWKURKC48zhKzXm75vjFmd436WQ==","signatures":[{"sig":"MEUCIQCl2+8GS+1/z2jhjax6T8/uzKSpPT8wyex3Oj2zU5vLewIgUZtJAos8aeyRsyS8D7dE2XhgApD2OY2JaZc/NyOonbI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31316,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcgpjZCRA9TVsSAnZWagAA1pIP/1m6XdEY/wGT7re708XI\ntDlv4/06klLLAdpqTO8iR4Qur92MN5JdF96DTW1KTpvp8htoF9Cqt14XWM0x\nVaVsQHuFPbLh3EN7JDp9MgyezyRXx+6Y0EMc9CwleeCsKGwlZ8nLzz341FWL\n0Jc9+2kFCdOb9QS9RZBVB19F4UPleQWrp463rbdbfdopS4l3ALe+k6OK5rtd\nqKN5Dt8/He22lX4CIAaXADFzITcY4/+6C1Y8rpUiB5KjEYyn4JBYcIT9J33B\ntkiL+efq+5VLrKIyMOB0DEDSQ0xuf09V5ana9wVRDia7zJLk1CuK19NAPDar\nBZNKLrS2DiuHwvI5w9WSFETXRjlu6yypL5t53QmM9R7tfIurgVS//RsUzZy/\narSAqhRfy5hburuAZeyLZo6AsuCwe/IbRHudYEcGenvQqw+2KGk/FYvsHis4\nl5j/uF01ovp+TSf7nGmMrODxkGqjOc43XSshrCShdcOdmxXMAu1eaAPoiKNa\n/NKAzYjkCfIoXa8cWrtrPfryREVyZLVXqLQPiUSo/5XTcXf54X96e/wgvb2h\nYqowjUSESNS83anfkgEr7rNpfYmKYekQPp+HgEIsmNz9aXv9+M7BtTpavYUc\nFmDV1C3LgAQMxGlXF22dmhmjH6GTrs43/FrTx+L8McJkgNy1oGI9VDqztjtx\nIpSk\r\n=A7Nw\r\n-----END PGP SIGNATURE-----\r\n","size":9809,"noattachment":false,"key":"/fx/-/fx-13.0.0.tgz"},"engines":{"node":">=8"},"gitHead":"e4e41c7391af9dedf1ab3d9084d18e6559478389","scripts":{"zip":"cd dist && find . -name 'fx-*' -exec zip '{}.zip' '{}' \\;","test":"ava","build":"pkg . --out-path dist -t node8-linux-x64,node8-macos-x64,node8-win-x64","release":"rm -rf ./dist && npm run build && npm run zip && release-it --github.release --github.assets=dist/*.zip","docker:tag":"docker tag antonmedv/fx:latest antonmedv/fx:`fx package.json .version`","docker:push":"docker push antonmedv/fx:latest && docker push antonmedv/fx:`fx package.json .version`","brew:release":"brew bump-formula-pr --url=https://registry.npmjs.org/fx/-/fx-`fx package.json .version`.tgz --no-audit fx","docker:build":"docker build -t antonmedv/fx:latest .","docker:release":"npm run docker:build && npm run docker:tag && npm run docker:push"},"_npmUser":{"name":"medv","email":"anton@medv.io"},"repository":{"url":"git+https://github.com/antonmedv/fx.git","type":"git"},"_npmVersion":"6.8.0","description":"Command-line JSON viewer","directories":{},"_nodeVersion":"11.3.0","dependencies":{"chalk":"^2.4.2","string-width":"^3.0.0","@medv/blessed":"^2.0.0","indent-string":"^3.2.0"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^1.2.1","pkg":"^4.3.7","release-it":"^10.1.0"},"_npmOperationalInternal":{"tmp":"tmp/fx_13.0.0_1552062680912_0.3775795758784537","host":"s3://npm-registry-packages"},"readme":"# fx\n\nA non-interactive, JavaScript version of the [**fx**](https://fx.wtf). \nShort for _Function eXecution_ or _f(x)_.\n\n```sh\nnpm i -g fx\n```\n\nOr use **npx**:\n\n```sh\ncat file.json | npx fx .field\n```\n\nOr use **deno**:\n\n```sh\ncat file.json | deno run -A npm:fx .field\n```\n\n## Usage\n\nFx treats arguments as JavaScript functions. Fx passes the input data to the first\nfunction and then passes the result of the first function to the second function \nand so on.\n\n```sh\necho '{\"name\": \"world\"}' | fx 'x => x.name' 'x => `Hello, ${x}!`'\n```\n\nUse `this` to access the input data. Use `.` at the start of the expression to \naccess the input data without a `x => x` part.\n\n```sh\necho '{\"name\": \"world\"}' | fx '.name' '`Hello, ${this}!`'\n```\n\nUse other JS functions to process the data.\n\n```sh\necho '{\"name\": \"world\"}' | fx 'Object.keys'\n```\n\n### Stream processing\n\nFx can process a stream of json objects. Fx will apply arguments to each object.\n\n```sh\necho '{\"name\": \"hello\"}\\n{\"name\": \"world\"}' | fx '.name'\n```\n\nIf you want to process a stream of json objects as a single array, \nuse the **--slurp** or **-s** flag.\n\n```sh\necho '{\"name\": \"hello\"}\\n{\"name\": \"world\"}' | fx --slurp '.map(x => x.name)' '.join(\", \")'\n```\n\n### Raw input\n\nIf you want to process non-JSON data, use the **--raw** or **-r** flag.\n\n```sh\nls | fx -r '[this, this.includes(\".md\")]'\n```\n\nYou can use **--raw** and **--slurp** (or **-rs**) together to get a single array of strings.\n\n```sh\nls | fx -rs '.filter(x => x.includes(\".md\"))'\n```\n\nFx has a special symbol **skip** for skipping the printing of the result.\n\n```sh\nls | fx -r '.includes(\".md\") ? this : skip'\n```\n\n### Built-in functions\n\nFx comes with a set of useful functions: **uniq**, **sort**, **groupBy**, **chunk**, **zip**.\n\n```sh\ncat file.json | fx 'uniq' 'sort' 'groupBy(x => x.name)'\n```\n\n### Edit-in-place\n\nYou can use special function **save** to edit-in-place the input data.\n\n```sh\nfx file.json 'x.name = x.name.toUpperCase(), x' 'save'\n```\n\nThe edited data will be saved to the same `file.json` file.\n\n### Syntactic Sugar\n\nPrefix an expression with `@` to apply it to each item of an array. For example,\n`.map(x => x.commit.message)` can be written as `@.commit.message`.\n\n```sh\ncurl https://api.github.com/repos/antonmedv/fx/commits | fx '@.commit.message'\n```\n\n```sh\necho '[{\"name\": \"world\"}]' | fx '@`Hello, ${x.name}!`'\n```\n\nFx has a special syntax for the flatMap function. Fox example,\n`.issues.flatMap(x => x.labels.flatMap(x => x))` can be rewritten in the next way.\n\n```sh\ncurl https://fx.wtf/example.json | fx '.issues[].labels[]'\n```\n\n### .fxrc.js\n\nFx supports `.fxrc.js` file in the current directory, or in the home directory, or in XDG config directory.\n\nPut the next code in the `.fxrc.js` file to make `myFunction` available in the fx.\n\n```js\nfunction addOne(x) {\n  return x + 1\n}\n```\n\nNow you can use `addOne` in the fx.\n\n```sh\necho '1' | fx addOne\n```\n\nIf you would like to create global variables use `var` instead of `let` or `const`.\n\n## License\n\n[MIT](../LICENSE)\n","publish_time":1552062681078,"_cnpm_publish_time":1552062681078,"dist-tags":{"latest":"40.0.1"}}