Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

1
node_modules/ldjson-stream/.npmignore generated vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

32
node_modules/ldjson-stream/index.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
var through = require('through2')
var split = require('split2')
var EOL = require('os').EOL
module.exports = parse
module.exports.serialize = serialize
module.exports.parse = parse
function parse(opts) {
opts = opts || {}
opts.strict = opts.strict !== false
function strict(row) {
if (row) return JSON.parse(row)
}
function nonStrict(row) {
try {
if (row) return JSON.parse(row)
} catch(e) {
// ignore
}
}
return opts.strict ? split(strict) : split(nonStrict)
}
function serialize() {
return through.obj(function(obj, enc, cb) {
cb(null, JSON.stringify(obj) + EOL)
})
}

75
node_modules/ldjson-stream/package.json generated vendored Normal file
View File

@@ -0,0 +1,75 @@
{
"_args": [
[
"ldjson-stream@^1.2.1",
"/Users/pmarsceill/_projects/just-the-docs/node_modules/doiuse"
]
],
"_from": "ldjson-stream@>=1.2.1 <2.0.0",
"_id": "ldjson-stream@1.2.1",
"_inCache": true,
"_installable": true,
"_location": "/ldjson-stream",
"_npmUser": {
"email": "max@maxogden.com",
"name": "maxogden"
},
"_npmVersion": "1.4.9",
"_phantomChildren": {},
"_requested": {
"name": "ldjson-stream",
"raw": "ldjson-stream@^1.2.1",
"rawSpec": "^1.2.1",
"scope": null,
"spec": ">=1.2.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/css-rule-stream",
"/doiuse"
],
"_resolved": "https://registry.npmjs.org/ldjson-stream/-/ldjson-stream-1.2.1.tgz",
"_shasum": "91beceda5ac4ed2b17e649fb777e7abfa0189c2b",
"_shrinkwrap": null,
"_spec": "ldjson-stream@^1.2.1",
"_where": "/Users/pmarsceill/_projects/just-the-docs/node_modules/doiuse",
"author": {
"name": "max ogden"
},
"bugs": {
"url": "https://github.com/maxogden/ldjson-stream/issues"
},
"dependencies": {
"split2": "^0.2.1",
"through2": "^0.6.1"
},
"description": "streaming line delimited json parser + serializer",
"devDependencies": {
"tape": "^2.13.3"
},
"directories": {},
"dist": {
"shasum": "91beceda5ac4ed2b17e649fb777e7abfa0189c2b",
"tarball": "https://registry.npmjs.org/ldjson-stream/-/ldjson-stream-1.2.1.tgz"
},
"homepage": "https://github.com/maxogden/ldjson-stream",
"license": "BSD",
"main": "index.js",
"maintainers": [
{
"name": "maxogden",
"email": "max@maxogden.com"
}
],
"name": "ldjson-stream",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/maxogden/ldjson-stream.git"
},
"scripts": {
"test": "tape test.js"
},
"version": "1.2.1"
}

55
node_modules/ldjson-stream/readme.md generated vendored Normal file
View File

@@ -0,0 +1,55 @@
# ldjson-stream
#### streaming line delimited json parser + serializer
[![NPM](https://nodei.co/npm/ldjson-stream.png)](https://nodei.co/npm/ldjson-stream/)
## usage
```
var ldj = require('ldjson-stream')
```
#### ldj.parse()
returns a transform stream that accepts newline delimited json and emits objects
example newline delimited json:
`data.txt`:
```
{"foo": "bar"}
{"hello": "world"}
```
If you want to discard non-valid JSON messages, you can call `ldj.parse({strict: false})`
usage:
```js
fs.createReadStream('data.txt')
.pipe(ldj.parse())
.on('data', function(obj) {
// obj is a javascript object
})
```
#### ldj.serialize()
returns a transform stream that accepts json objects and emits newline delimited json
example usage:
```js
var serialize = ldj.serialize()
serialize.on('data', function(line) {
// line is a line of stringified JSON with a newline delimiter at the end
})
serialize.write({"foo": "bar"})
serialize.end()
```
### license
BSD

35
node_modules/ldjson-stream/test.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
var test = require('tape')
var ldj = require('./')
var os = require('os')
test('.parse', function(t) {
var parser = ldj.parse()
parser.on('data', function(obj) {
t.equal(obj.hello, 'world')
t.end()
})
parser.write('{"hello": "world"}\n')
})
test('.parse twice', function(t) {
var parser = ldj.parse()
parser.once('data', function(obj) {
t.equal(obj.hello, 'world')
parser.once('data', function(obj) {
t.equal(obj.hola, 'mundo')
t.end()
})
})
parser.write('{"hello": "world"}\n{"hola": "mundo"}\n')
})
test('.serialize', function(t) {
var serializer = ldj.serialize()
serializer.on('data', function(data) {
t.equal(data, '{"hello":"world"}' + os.EOL)
t.end()
})
serializer.write({hello: 'world'})
})