question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for spread syntax

See original GitHub issue

This is supported natively in Node.js v8 and v10.

h3. Steps to reproduce

See GitHub repo with demo

$ git clone https://github.com/leedm777/power-spread.git

$ cd power-spread

$ node --version
v8.11.1

$ npx mocha


  spread operator
    ✓ should work


  1 passing (6ms)


$ npx mocha --require intelli-espower-loader

/Users/dlee/prj/tmp/power-spread/node_modules/espower-source/index.js:165
    var err = new SyntaxError(detail);
              ^
SyntaxError:
     1: const assert = require('assert');
     2:
     3: describe('spread operator', () => {
     4:   it('should work', () => {
     5:     const obj = { a: 1, b: 2 };
     6:     const actual = { ...obj, c: 3 };
                            ^
     7:     assert.deepStrictEqual(actual, { a: 1, b: 2, c: 3 });
     8:   });
     9: });
    10:

Parse Error: Unexpected token (6:21) in /Users/dlee/prj/tmp/power-spread/test/spread.js

h3. Expected results

mocha --require intelli-espower-loader should parse and execute the tests.

h3. Actual results

Fails to parse the spread operator.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
twadacommented, Jun 13, 2018
1reaction
twadacommented, May 9, 2018

@leedm777 Thank you for reporting! I’ll update parser soon so wait a moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
In an object literal, the spread syntax enumerates the properties of an object and adds the key-value pairs to the object being created....
Read more >
An introduction to Spread syntax in JavaScript - freeCodeCamp
Spread syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for...
Read more >
How to Use the Spread Operator (…) in JavaScript - Medium
The spread operator is a useful and quick syntax for adding items to arrays, combining arrays or objects, and spreading an array out...
Read more >
Rest parameters and spread syntax
The spread syntax is used to pass an array to functions that normally require a list of many arguments. Together they help to...
Read more >
The Practical Usages of JavaScript Spread Operator
The spread operator unpacks elements of iterable objects such as arrays, sets, and maps into a list. The rest paramter is also denoted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found