Created
February 21, 2020 16:56
-
-
Save painedpineapple/1c1878b815fe31e32645dd03f922e109 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type parsed = { | |
data: Js.Json.t, | |
errors: array(string), | |
}; | |
external jsonToJsOb: Js.Json.t => Js.t('a) = "%identity"; | |
type error = { | |
type_: string, | |
code: string, | |
message: string, | |
row: int, | |
}; | |
type config('file, 'inputElem) = { | |
download: bool, | |
quotes: bool, | |
quoteChar: string, | |
escapeChar: string, | |
delimiter: string, | |
header: bool, | |
newline: string, | |
skipEmptyLines: bool, | |
columns: Js.Nullable.t(array(string)), | |
complete: parsed => unit, | |
error: (error, 'file, 'inputElem, string) => unit, | |
before: ('file, 'inputElem) => unit, | |
}; | |
let defaultConfig = { | |
download: false, | |
quotes: false, | |
quoteChar: "\"", | |
escapeChar: "\"", | |
delimiter: ",", | |
header: false, | |
newline: "\n", | |
skipEmptyLines: false, | |
columns: Js.Nullable.null, | |
complete: _ => (), | |
error: (_, _, _, _) => (), | |
before: (_, _) => (), | |
}; | |
[@bs.module "papaparse"] | |
external parse: ('a, config('file, 'inputElem)) => unit = "parse"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment