Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support object spread syntax ({...d, }) in ndjson-map #40

Open
stevage opened this issue Jan 17, 2020 · 2 comments · May be fixed by #42
Open

Support object spread syntax ({...d, }) in ndjson-map #40

stevage opened this issue Jan 17, 2020 · 2 comments · May be fixed by #42

Comments

@stevage
Copy link

stevage commented Jan 17, 2020

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.

@mbostock
Copy link
Owner

I think we’d just need to update the version of Acorn and configure the ecmaVersion to allow new language features.

@derhuerst
Copy link

derhuerst commented Jun 3, 2020

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?

Node.js >= 8.3.0 support the spread operator in objects.

@derhuerst derhuerst linked a pull request Jun 3, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants