1- // Type definitions for csv-file-validator 1.10
1+ // Type definitions for csv-file-validator 1.11
22// Project: https://github.com/shystruk/csv-file-validator
33// Definitions by: Igor Levkov <https://github.com/igors-levkovs>
44/// <reference types="node" />
55
66export interface FieldSchema < Error = string > {
77 /** Name of the row header (title) */
88 name : string ;
9+
910 /** Key name which will be return with value in a column */
1011 inputName : string ;
12+
1113 /** Makes column optional. If true column value will be return */
1214 optional ?: boolean ;
15+
1316 /** If required is true than a column value will be checked if it is not empty */
1417 required : boolean ;
18+
1519 /** If it is true all header (title) column values will be checked for uniqueness */
1620 unique ?: boolean ;
21+
1722 /** If column contains list of values separated by comma in return object it will be as an array */
1823 isArray ?: boolean ;
24+
1925 /** If a header name is omitted or is not the same as in config name headerError function will be called with arguments headerName */
2026 headerError ?: ( headerValue : string , headerName : string , rowNumber : number , columnNumber : number ) => Error ;
27+
2128 /** If value is empty requiredError function will be called with arguments headerName, rowNumber, columnNumber */
2229 requiredError ?: ( headerName : string , rowNumber : number , columnNumber : number ) => Error ;
30+
2331 /** If one of the header value is not unique uniqueError function will be called with argument headerName */
2432 uniqueError ?: ( headerName : string , rowNumber : number ) => Error ;
33+
2534 /** Validate column value. Must return true for valid field and false for invalid */
2635 validate ?: ( field : string ) => boolean ;
36+
2737 /** If validate returns false validateError function will be called with arguments headerName, rowNumber, columnNumber */
2838 validateError ?: ( headerName : string , rowNumber : number , columnNumber : number ) => Error ;
2939}
@@ -44,4 +54,4 @@ export interface ValidatorConfig<Error = string> {
4454export default function CSVFileValidator < Row = any , Error = string > (
4555 csv : string | File | NodeJS . ReadableStream ,
4656 config : ValidatorConfig < Error >
47- ) : Promise < ParsedResults < Row , Error > > ;
57+ ) : Promise < ParsedResults < Row , Error > > ;
0 commit comments