Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,11 @@ | ||
## 1.1.0 | ||
#### Chore | ||
* fix changelog bug with versioning ([aa23d6b](https://github.com/DonutEspresso/big-json/commit/aa23d6b0cc70c4032625bac0bc6b0880cf603f97)) | ||
#### New | ||
* add support for multibyte chars (#2) ([ec4bb36](https://github.com/DonutEspresso/big-json/commit/ec4bb3661ecde84c2d214e4b8d24a4f9725d8722)) | ||
## 1.0.0 | ||
@@ -2,0 +12,0 @@ |
@@ -9,2 +9,3 @@ 'use strict'; | ||
const stringifyStreamFactory = require('json-stream-stringify'); | ||
const utf8Stream = require('utf8-stream'); | ||
@@ -38,6 +39,16 @@ | ||
* @public | ||
* @param {Object} [options] an options object | ||
* @param {Object} [options.multibyte] when true, support multibyte | ||
* @function createParseStream | ||
* @return {Stream} | ||
*/ | ||
function createParseStream() { | ||
function createParseStream(options) { | ||
const opts = Object.assign({ | ||
multibyte: true | ||
}, options); | ||
assert.optionalObject(opts, 'opts'); | ||
assert.optionalBool(opts.multibyte, 'opts.multibyte'); | ||
const assembler = new Assembler(); | ||
@@ -68,3 +79,10 @@ const parseStream = new JSONParseStream({ | ||
source.unpipe(this); | ||
this.transformStream = source.pipe(parseStream); | ||
// pipe the stream, prepend with multibyte if necessary. utf8stream can | ||
// never error, so no need to handle errors here. | ||
if (opts.multibyte === true) { | ||
this.transformStream = source.pipe(utf8Stream()).pipe(parseStream); | ||
} else { | ||
this.transformStream = source.pipe(parseStream); | ||
} | ||
redirected = true; | ||
@@ -71,0 +89,0 @@ }); |
{ | ||
"name": "big-json", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "lib/index.js", | ||
@@ -40,4 +40,5 @@ "description": "A stream based implementation of JSON.parse and JSON.stringify for big POJOs", | ||
"stream-json": "^0.5.2", | ||
"through2": "^2.0.3" | ||
"through2": "^2.0.3", | ||
"utf8-stream": "0.0.0" | ||
} | ||
} |
@@ -87,4 +87,7 @@ # big-json | ||
### createParseStream() | ||
### createParseStream(opts) | ||
* `opts` {Object} an options object | ||
* `opts.multibyte` {Boolean} handle multibyte chars, defaults to true | ||
__Returns__: {Stream} a JSON.parse stream | ||
@@ -91,0 +94,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12539
114
128
5
+ Addedutf8-stream@0.0.0
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedutf8-stream@0.0.0(transitive)