@loaders.gl/csv 4.3.1 → 4.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/csv-arrow-loader.d.ts +37 -0
- package/dist/csv-arrow-loader.d.ts.map +1 -0
- package/dist/csv-arrow-loader.js +23 -0
- package/dist/csv-format.d.ts +10 -0
- package/dist/csv-format.d.ts.map +1 -0
- package/dist/csv-format.js +12 -0
- package/dist/csv-loader.d.ts +6 -6
- package/dist/csv-loader.d.ts.map +1 -1
- package/dist/csv-loader.js +53 -20
- package/dist/csv-writer.d.ts +6 -5
- package/dist/csv-writer.d.ts.map +1 -1
- package/dist/csv-writer.js +2 -5
- package/dist/dist.dev.js +13318 -449
- package/dist/dist.min.js +23 -20
- package/dist/index.cjs +317 -262
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/encoders/encode-csv.d.ts +1 -1
- package/dist/lib/encoders/encode-csv.d.ts.map +1 -1
- package/dist/lib/encoders/encode-csv.js +1 -1
- package/dist/papaparse/async-iterator-streamer.d.ts +1 -21
- package/dist/papaparse/async-iterator-streamer.d.ts.map +1 -1
- package/dist/papaparse/async-iterator-streamer.js +6 -6
- package/dist/papaparse/papa-constants.d.ts +12 -0
- package/dist/papaparse/papa-constants.d.ts.map +1 -0
- package/dist/papaparse/papa-constants.js +19 -0
- package/dist/papaparse/papa-parser.d.ts +110 -0
- package/dist/papaparse/papa-parser.d.ts.map +1 -0
- package/dist/papaparse/papa-parser.js +733 -0
- package/dist/papaparse/papa-writer.d.ts +22 -0
- package/dist/papaparse/papa-writer.d.ts.map +1 -0
- package/dist/papaparse/papa-writer.js +166 -0
- package/dist/papaparse/papaparse.d.ts +9 -113
- package/dist/papaparse/papaparse.d.ts.map +1 -1
- package/dist/papaparse/papaparse.js +13 -882
- package/package.json +5 -5
- package/src/csv-arrow-loader.ts +41 -0
- package/src/csv-format.ts +15 -0
- package/src/csv-loader.ts +58 -25
- package/src/csv-writer.ts +2 -5
- package/src/index.ts +3 -0
- package/src/lib/encoders/encode-csv.ts +2 -1
- package/src/papaparse/async-iterator-streamer.ts +6 -6
- package/src/papaparse/papa-constants.ts +23 -0
- package/src/papaparse/papa-parser.ts +872 -0
- package/src/papaparse/papa-writer.ts +219 -0
- package/src/papaparse/papaparse.ts +17 -1048
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export type CSVParserConfig = {
|
|
2
|
+
chunk?: boolean;
|
|
3
|
+
chunkSize?: number | null;
|
|
4
|
+
preview?: number;
|
|
5
|
+
newline?: string;
|
|
6
|
+
comments?: boolean | string;
|
|
7
|
+
skipEmptyLines?: boolean | 'greedy';
|
|
8
|
+
delimitersToGuess?: string[];
|
|
9
|
+
quotes?: string[] | boolean;
|
|
10
|
+
quoteChar?: string;
|
|
11
|
+
escapeChar?: string;
|
|
12
|
+
delimiter?: string | Function;
|
|
13
|
+
fastMode?: boolean;
|
|
14
|
+
dynamicTyping?: boolean | {};
|
|
15
|
+
dynamicTypingFunction?: Function;
|
|
16
|
+
step?: Function;
|
|
17
|
+
transform?: Function;
|
|
18
|
+
complete?: Function;
|
|
19
|
+
};
|
|
20
|
+
export declare function CsvToJson(_input: any, _config?: CSVParserConfig, Streamer?: any): any;
|
|
21
|
+
/** ChunkStreamer is the base prototype for various streamer implementations. */
|
|
22
|
+
export declare class ChunkStreamer {
|
|
23
|
+
_handle: any;
|
|
24
|
+
_config: any;
|
|
25
|
+
_finished: boolean;
|
|
26
|
+
_completed: boolean;
|
|
27
|
+
_input: null;
|
|
28
|
+
_baseIndex: number;
|
|
29
|
+
_partialLine: string;
|
|
30
|
+
_rowCount: number;
|
|
31
|
+
_start: number;
|
|
32
|
+
isFirstChunk: boolean;
|
|
33
|
+
_completeResults: {
|
|
34
|
+
data: never[];
|
|
35
|
+
errors: never[];
|
|
36
|
+
meta: {};
|
|
37
|
+
};
|
|
38
|
+
constructor(config: CSVParserConfig);
|
|
39
|
+
parseChunk(chunk: any, isFakeChunk?: boolean): any;
|
|
40
|
+
_sendError(error: any): void;
|
|
41
|
+
}
|
|
42
|
+
export declare class ParserHandle {
|
|
43
|
+
_config: any;
|
|
44
|
+
/** Number of times step was called (number of rows parsed) */
|
|
45
|
+
_stepCounter: number;
|
|
46
|
+
/** Number of rows that have been parsed so far */
|
|
47
|
+
_rowCounter: number;
|
|
48
|
+
/** The input being parsed */
|
|
49
|
+
_input: any;
|
|
50
|
+
/** The core parser being used */
|
|
51
|
+
_parser: any;
|
|
52
|
+
/** Whether we are paused or not */
|
|
53
|
+
_paused: boolean;
|
|
54
|
+
/** Whether the parser has aborted or not */
|
|
55
|
+
_aborted: boolean;
|
|
56
|
+
/** Temporary state between delimiter detection and processing results */
|
|
57
|
+
_delimiterError: boolean;
|
|
58
|
+
/** Fields are from the header row of the input, if there is one */
|
|
59
|
+
_fields: string[];
|
|
60
|
+
/** The last results returned from the parser */
|
|
61
|
+
_results: {
|
|
62
|
+
data: any[][] | Record<string, any>[];
|
|
63
|
+
errors: any[];
|
|
64
|
+
meta: Record<string, any>;
|
|
65
|
+
};
|
|
66
|
+
constructor(_config: CSVParserConfig);
|
|
67
|
+
/**
|
|
68
|
+
* Parses input. Most users won't need, and shouldn't mess with, the baseIndex
|
|
69
|
+
* and ignoreLastRow parameters. They are used by streamers (wrapper functions)
|
|
70
|
+
* when an input comes in multiple chunks, like from a file.
|
|
71
|
+
*/
|
|
72
|
+
parse(input: any, baseIndex: any, ignoreLastRow: any): {
|
|
73
|
+
data: any[][] | Record<string, any>[];
|
|
74
|
+
errors: any[];
|
|
75
|
+
meta: Record<string, any>;
|
|
76
|
+
} | {
|
|
77
|
+
meta: {
|
|
78
|
+
paused: boolean;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
paused(): boolean;
|
|
82
|
+
pause(): void;
|
|
83
|
+
resume(): void;
|
|
84
|
+
aborted(): boolean;
|
|
85
|
+
abort(): void;
|
|
86
|
+
testEmptyLine(s: any): boolean;
|
|
87
|
+
processResults(): {
|
|
88
|
+
data: any[][] | Record<string, any>[];
|
|
89
|
+
errors: any[];
|
|
90
|
+
meta: Record<string, any>;
|
|
91
|
+
};
|
|
92
|
+
needsHeaderRow(): any;
|
|
93
|
+
fillHeaderFields(): void;
|
|
94
|
+
shouldApplyDynamicTyping(field: any): boolean;
|
|
95
|
+
parseDynamic(field: any, value: any): any;
|
|
96
|
+
applyHeaderAndDynamicTypingAndTransformation(): {
|
|
97
|
+
data: any[][] | Record<string, any>[];
|
|
98
|
+
errors: any[];
|
|
99
|
+
meta: Record<string, any>;
|
|
100
|
+
};
|
|
101
|
+
processRow(rowSource: any, i: any): any[] | Record<string, any>;
|
|
102
|
+
guessDelimiter(input: any, newline: any, skipEmptyLines: any, comments: any, delimitersToGuess: any): {
|
|
103
|
+
successful: boolean;
|
|
104
|
+
bestDelimiter: any;
|
|
105
|
+
};
|
|
106
|
+
addError(type: any, code: any, msg: any, row?: any): void;
|
|
107
|
+
}
|
|
108
|
+
/** The core parser implements speedy and correct CSV parsing */
|
|
109
|
+
export declare function Parser(config?: CSVParserConfig): void;
|
|
110
|
+
//# sourceMappingURL=papa-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"papa-parser.d.ts","sourceRoot":"","sources":["../../src/papaparse/papa-parser.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,CAAC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