Skip to content

Conversation

@bfdykstra
Copy link

… large datasets are used the maximum call stack is not exceeded

When converting a large object (like ~150k records) to the csv arrays, the maximum call stack gets exceeded by invoking the map callback on the data variable. Instead if we just use a regular for-loop to push the in to the csvInput array, we don't need to invoke a callback for each record. Hope this helps and please let me know if you have any questions :)

Thanks for making this! It's super helpful

… large datasets are used the maximum call stack is not exceeded
@anton-bot anton-bot self-assigned this Oct 14, 2019
@pabloalvzal
Copy link

This LGTM, any reason why it hasn't moved to master? 😍 I've tried this change and worked locally for me on a large dataset where I was having node's call stack issue as well.

@angeeltrujillo
Copy link

You're iterating twice over the array.

You could use:

for (let i = 0, len = data.length; i < len; i++) {
        csvInput.push(columnNames.map((column) => data[i][column]));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants