mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
Papaparse: Fix NODE_STREAM_INPUT for TypeScript/next test (#36419)
* separate type and value for NODE_STREAM_INPUT * add test for NODE_STREAM_INPUT * format
This commit is contained in:
committed by
Benjamin Lichtman
parent
5cda518f79
commit
0385d7f65c
Vendored
+2
-1
@@ -24,7 +24,7 @@ export function parse(file: File, config?: ParseConfig): ParseResult;
|
||||
|
||||
export function parse(stream: NodeJS.ReadableStream, config?: ParseConfig): ParseResult;
|
||||
|
||||
export function parse(stream: typeof NODE_STREAM_INPUT, config?: ParseConfig): NodeJS.ReadWriteStream;
|
||||
export function parse(stream: NODE_STREAM_INPUT_TYPE, config?: ParseConfig): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Unparses javascript data objects and returns a csv string
|
||||
@@ -55,6 +55,7 @@ export const WORKERS_SUPPORTED: boolean;
|
||||
export let SCRIPT_PATH: string;
|
||||
|
||||
// When passed to Papa Parse a Readable stream is returned.
|
||||
declare type NODE_STREAM_INPUT_TYPE = 1;
|
||||
export const NODE_STREAM_INPUT = 1;
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,26 +33,28 @@ Papa.parse("3,3,3", {
|
||||
dynamicTyping: (field: string | number): boolean => /headerName/i.test(field.toString())
|
||||
});
|
||||
|
||||
Papa.parse("3,3,3", {
|
||||
dynamicTyping: {'headerName': true}
|
||||
Papa.parse('3,3,3', {
|
||||
dynamicTyping: { headerName: true },
|
||||
});
|
||||
|
||||
Papa.parse("3,3,3", {
|
||||
dynamicTyping: {5: true}
|
||||
Papa.parse('3,3,3', {
|
||||
dynamicTyping: { 5: true },
|
||||
});
|
||||
|
||||
var file = new File(null, null, null);
|
||||
|
||||
Papa.parse(file, {
|
||||
transform: function(value, field) {
|
||||
|
||||
},
|
||||
complete: function (a, b) {
|
||||
transform: function(value, field) {},
|
||||
complete: function(a, b) {
|
||||
a.meta.fields;
|
||||
b.name;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// .pipe to make sure it returns a stream
|
||||
Papa.parse(Papa.NODE_STREAM_INPUT, {
|
||||
}).pipe
|
||||
|
||||
const readable = new Readable()
|
||||
const rows = [
|
||||
"1,2,3",
|
||||
|
||||
Reference in New Issue
Block a user