Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

recursive pattern example giving undefined error - line 71 on index.js #159

Open
ituhin opened this issue Jul 30, 2018 · 1 comment
Open

Comments

@ituhin
Copy link

ituhin commented Jul 30, 2018

JSONStream.parse('docs..value') (or JSONStream.parse(['docs', {recurse: true}, 'value'])

giving error for the example json

{
"total": 5,
"docs": [
{
"key": {
"value": 0,
"some": "property"
}
},
{"value": 1},
{"value": 2},
{"blbl": [{}, {"a":0, "b":1, "value":3}, 10]},
{"value": 4}
]
}

code -
const readStream = fs.createReadStream('../test.json')

readStream
.pipe(JSONStream.parse('docs..value')) //or JSONStream.parse(['docs', {recurse: true}, 'value'])
.pipe(es.mapSync(function (data) {
console.log(data)
return data
}))

@ituhin
Copy link
Author

ituhin commented Jul 30, 2018

fixed.

added a check in index.js on line 71

if(this.stack[j])
this.stack[j].value = null

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant