1.0.1 • Published 6 years ago

wait-for-papa-parse v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Wait For Papa Parse

A package that handles a file upload and waits for papaparse to finish parsing before returning data (i.e. no more "undefined" errors in the console)

Installation

npm install wait-for-papa-parse

Usage (Example in ReactJs)

Must be used with async function.

<form name="inputForm" onChange={this.handleUpload}>
    <input type="file" id="csv-file" name="files" />
</form>
import waitForPapaParse from 'wait-for-papa-parse'

handleUpload = async (e) => {
    const file = e.target.files[0];
    const response = await waitForPapaParse(file)
    console.log(response) // {data: [], errors: [], meta: {}}
}

Note: The function will return the following Papa Parse object:

{
    data: [],
    errors: [],
    meta: {}
}
1.0.1

6 years ago

1.0.0

6 years ago