jstdin
a better `node -p` that accepts stdin and can format and highlight output
Last updated 2 years ago by buster .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jstdin 
SYNC missed versions from official npm registry.

jstdin NPM version Build Status Dependency Status Coverage percentage Greenkeeper badge

a better node -p that accepts stdin and can format and highlight output

FYI

jstdin works really well in conjunction with lbl (a line-by-line stdin parser, sort of like AWK, but 100% JS)

Installation

$ npm install jstdin --global

Usage

$ jstdin --help

  Usage:

    $ jstdin [code] [options]

  Description:

    executes javascript on the command line like `node -p`
    but also accepts data via stdin so long as [code] is wrapped
    with an anonymous function; it also formats output.

  Options:

    -r, --raw   prevent formatting output
    -h, --help  show this usage information

  Examples:

    # eval and print js (like node -p)
    $ jstdin '2*2'
    4

    # use stdin, process and pretty print
    $ echo '[1,2,3]' | jstdin 'x => x.map(x => x*2)'
    [
      2,
      4,
      6
    ]

    # use stdin, process and do not pretty print
    $ echo '[1,2,3]' | jstdin 'x => x.map(x => x*2)' --raw
    [2,4,6]

    # use stdin and just pretty print
    $ echo '[{"n":1,"a":{"b":"c"}},{"n":2,"a":{"d":{"e":"f"}}}]' | jstdin'
    [
      {
        "n": 1,
        "a": {
          "b": "c"
        }
      },
      {
        "n": 2,
        "a": {
          "d": "e"
        }
      }
    ]

Inspiration:

License

ISC © Buster Collings

Current Tags

  • 0.11.2                                ...           latest (2 years ago)

6 Versions

  • 0.11.2                                ...           2 years ago
  • 0.11.1                                ...           2 years ago
  • 0.10.1                                ...           2 years ago
  • 0.10.0                                ...           2 years ago
  • 0.9.3                                ...           2 years ago
  • 0.9.2                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (3)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |