Création d'un script séparé pour déclarer les interfaces correspondant aux options de Papa Parse
This commit is contained in:
parent
d90e38d5dc
commit
d980412b0f
@ -3,36 +3,14 @@ const errors= require("./errors.js");
|
||||
import { RemoteSource } from "./freeDatas2HTMLRemoteSource";
|
||||
|
||||
import { ParseResults, Parsers, RemoteSources, RemoteSourceSettings } from "./interfaces";
|
||||
|
||||
// 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;
|
||||
}
|
||||
import { PublicPapaParseOptions, PrivatePapaParseOptions } from "./interfacesPapaParse";
|
||||
|
||||
export class ParserForCSV implements Parsers
|
||||
{
|
||||
private _datasRemoteSource: RemoteSources;
|
||||
private _datas2Parse:string="";
|
||||
private _parseResults:ParseResults|undefined=undefined;
|
||||
public options: PublicPapaParseOptions =
|
||||
public options: PublicPapaParseOptions=
|
||||
{
|
||||
delimiter:"",
|
||||
newline:"",
|
||||
@ -44,7 +22,7 @@ export class ParserForCSV implements Parsers
|
||||
fastMode:undefined,
|
||||
transform:undefined
|
||||
}
|
||||
private _privateOptions: PrivatePapaParseOptions =
|
||||
private _privateOptions: PrivatePapaParseOptions=
|
||||
{
|
||||
header:true,
|
||||
download:false,
|
||||
|
22
src/interfacesPapaParse.ts
Normal file
22
src/interfacesPapaParse.ts
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user