Closed wkmcyz closed 5 years ago
Actually I want to use sjs in react-native, however it seems that react-native does not support Array.flat
according to https://stackoverflow.com/a/52878753/9798666.
I found a workaround for this, which is to use array-flat-polyfill to add Array.flat
property.
Hi @wkmcyz π
Thank you for pointing out this compatibility issue!
I was using [acc].flat()
just for its convenient syntax.
I replaced it with an array check with a consequent manual wrapping into an array. As it's a lightweight workaround and it adds zero external dependencies.
This is the modified line: https://github.com/lucagez/slow-json-stringify/blob/master/src/_makeQueue.mjs#L35
Let me know if this fix your issues!
Hi @lucagez π. Of course this fixed the issue, thank you for such a great job to write sjs. It's really fastπ.
This is because the use of
Array.flat
API, which is not supported below nodev11.0.0
.Here is the Browser Compatibility of Array.flat. So as far as I am concerned, other implementations here may be better for more scenarios.