ndjson-cli
ndjson-cli copied to clipboard
Support object spread syntax ({...d, }) in ndjson-map
It would be really convenient if you could do this:
ndjson-map '{...d, newProp: 3}'
It currently throws an error:
ndjson-map:expression
({...d, newProp: 3})
^
SyntaxError: Unexpected token (1:3)
The current workaround is:
ndjson-map 'd.newProp = 3, d'
or
ndjson-map 'Object.assign(d, {newProp: 3})'
which feels less elegant.
I think we’d just need to update the version of Acorn and configure the ecmaVersion to allow new language features.
The currently used acorn version (^5.1.1, resolving to 5.7.4) already supports ECMAScript 9 a.k.a. ES2018. It doesn't make sense to parse expressions that the built-in vm module wouldn't be able to parse/run; What is the lowest Node.js version this package is supposed to support?