ldjson-keys
Pipe LDJSON in, get all of the keys found out
Last updated 5 years ago by radekstepan .
AGPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ldjson-keys 
SYNC missed versions from official npm registry.

#ldjson-keys

Pipe LDJSON in, get all of the keys found out.

This is useful in conjunction with maxogden/csv-write-stream that reads CSV columns from first row/object only.

Build Status Dependencies License

##Run

Install with npm.

$ npm install ldjson-to-csv -g

By default you get new-line delimited output:

$ echo '{"col1":1}\n{"col2":2}' | ldjson-to-csv
# col1
# col2

##Source

_       = require 'highland'
ndjson  = require 'ndjson'
{ EOL } = require 'os'

module.exports = ->
  keys = {}

  through = (obj) ->
    _ (push, next) ->
      for k of obj when k not of keys
        keys[k] = null
        push null, k + EOL
      push null, _.nil

  _.pipeline.apply _, [
    do _
    do ndjson.parse
    _.map through
    _.parallel 50
  ]

Current Tags

  • 0.0.0                                ...           latest (5 years ago)

1 Versions

  • 0.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |