Code not compatible with babel
IlyaSemenov opened this issue · 2 comments
IlyaSemenov commented
FYI, latest babel wouldn't compile this code:
Lines 1 to 6 in a947cba
with this error:
ERROR in ./node_modules/d3-array/src/cumsum.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /xxx/node_modules/d3-array/src/cumsum.js: Only '=' operator can be used for specifying default value. (4:15)
2 | var sum = 0, index = 0;
3 | return Float64Array.from(values, valueof === undefined
> 4 | ? v => (sum += +v || 0)
| ^
5 | : v => (sum += +valueof(v, index++, values) || 0));
6 | }
It's probably babel's issue, but I thought it was worth reporting it here, as may be it is an issue with d3-array
.
IlyaSemenov commented
My bad! Apparently a duplicate of #147. Also see babel/babel#11038
derwaldgeist commented
Just ran into the same error. #147 has been closed, but without any resolution. Upgrading Babel or downgrading d3-array is not an option for me, as I am using Meteor (which fixed Babel to a certain version) and react-globe
that relies on d3-array@2.12.2
and I wouldn't want to break it.
I would appreciate if the code could be rewritten without the assignment in the ternary operator.