Création d'un script séparé pour déclarer les interfaces correspondant aux options de Papa Parse

This commit is contained in:
Fabrice PENHOËT 2021-10-18 10:52:04 +02:00
parent d90e38d5dc
commit d980412b0f
2 changed files with 25 additions and 25 deletions

View File

@ -3,29 +3,7 @@ const errors= require("./errors.js");
import { RemoteSource } from "./freeDatas2HTMLRemoteSource"; import { RemoteSource } from "./freeDatas2HTMLRemoteSource";
import { ParseResults, Parsers, RemoteSources, RemoteSourceSettings } from "./interfaces"; import { ParseResults, Parsers, RemoteSources, RemoteSourceSettings } from "./interfaces";
import { PublicPapaParseOptions, PrivatePapaParseOptions } from "./interfacesPapaParse";
// Options de Papa Parse
// cf. https://www.papaparse.com/docs#config
interface PublicPapaParseOptions
{
delimiter: string;
newline: string;
quoteChar: string;
escapeChar: string;
transformHeader?(field: string, index: number): string;
preview: number;
comments: false|string;
fastMode: boolean|undefined;
transform?(value: string): string;
}
interface PrivatePapaParseOptions
{
header: boolean;
download: boolean;
downloadRequestHeaders: undefined| { [index: string]:string };
skipEmptyLines: string;
withCredentials: boolean|undefined;
}
export class ParserForCSV implements Parsers export class ParserForCSV implements Parsers
{ {

View File

@ -0,0 +1,22 @@
// Options de Papa Parse
// cf. https://www.papaparse.com/docs#config
interface PublicPapaParseOptions
{
delimiter: string;
newline: string;
quoteChar: string;
escapeChar: string;
transformHeader?(field: string, index: number): string;
preview: number;
comments: false|string;
fastMode: boolean|undefined;
transform?(value: string): string;
}
interface PrivatePapaParseOptions
{
header: boolean;
download: boolean;
downloadRequestHeaders: undefined| { [index: string]:string };
skipEmptyLines: string;
withCredentials: boolean|undefined;
}