json-to-ts
json-to-ts copied to clipboard
Reduce of empty array with no initial value
https://pastebin.com/tnx6CH5a
This JSON, will cause
TypeError: Reduce of empty array with no initial value
at Array.reduce (<anonymous>)
at pascalCase (.../node_modules/json-to-ts/build/src/get-names.js:82:10)
I tried change
- .reduce(function (a, b) { return a + b; });
+ .reduce(function (a, b) { return a + b; }, '');
And it works.
I think this workaround is not good enough, there maybe a bigger problem inside.