@bitbybit-dev/core
Version:
Bit By Bit Developers Core CAD API to Program Geometry
317 lines (316 loc) • 8.77 kB
TypeScript
export declare namespace CSV {
class ParseToArrayDto {
constructor(csv?: string, rowSeparator?: string, columnSeparator?: string);
/**
* CSV text to parse
* @default name,age\nJohn,30
*/
csv: string;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
}
class ParseToJsonDto {
constructor(csv?: string, headerRow?: number, dataStartRow?: number, rowSeparator?: string, columnSeparator?: string, numberColumns?: string[]);
/**
* CSV text to parse
* @default name,age\nJohn,30\nJane,25
*/
csv: string;
/**
* Row index where headers are located
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
headerRow?: number;
/**
* Row index where data starts
* @default 1
* @minimum 0
* @maximum Infinity
* @step 1
*/
dataStartRow?: number;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
/**
* Column names that should be converted to numbers
* @default undefined
* @optional true
*/
numberColumns?: string[];
}
class ParseToJsonWithHeadersDto {
constructor(csv?: string, headers?: string[], dataStartRow?: number, rowSeparator?: string, columnSeparator?: string, numberColumns?: string[]);
/**
* CSV text to parse
* @default John,30\nJane,25
*/
csv: string;
/**
* Custom header names to use
* @default ["name", "age"]
*/
headers: string[];
/**
* Row index where data starts
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
dataStartRow?: number;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
/**
* Column names that should be converted to numbers
* @default undefined
* @optional true
*/
numberColumns?: string[];
}
class QueryColumnDto {
constructor(csv?: string, column?: string, headerRow?: number, dataStartRow?: number, rowSeparator?: string, columnSeparator?: string, asNumber?: boolean);
/**
* CSV text to query
* @default name,age\nJohn,30\nJane,25
*/
csv: string;
/**
* Column name to query
* @default name
*/
column: string;
/**
* Row index where headers are located
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
headerRow?: number;
/**
* Row index where data starts
* @default 1
* @minimum 0
* @maximum Infinity
* @step 1
*/
dataStartRow?: number;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
/**
* Convert column values to numbers
* @default false
*/
asNumber?: boolean;
}
class QueryRowsByValueDto {
constructor(csv?: string, column?: string, value?: string, headerRow?: number, dataStartRow?: number, rowSeparator?: string, columnSeparator?: string, numberColumns?: string[]);
/**
* CSV text to query
* @default name,age\nJohn,30\nJane,25
*/
csv: string;
/**
* Column name to filter by
* @default age
*/
column: string;
/**
* Value to match
* @default 30
*/
value: string;
/**
* Row index where headers are located
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
headerRow?: number;
/**
* Row index where data starts
* @default 1
* @minimum 0
* @maximum Infinity
* @step 1
*/
dataStartRow?: number;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
/**
* Column names that should be converted to numbers
* @default undefined
* @optional true
*/
numberColumns?: string[];
}
class ArrayToCsvDto {
constructor(array?: (string | number | boolean | null | undefined)[][], rowSeparator?: string, columnSeparator?: string);
/**
* 2D array to convert
* @default [["name", "age"], ["John", "30"]]
*/
array: (string | number | boolean | null | undefined)[][];
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
}
class JsonToCsvDto<T = Record<string, unknown>> {
constructor(json?: T[], headers?: string[], includeHeaders?: boolean, rowSeparator?: string, columnSeparator?: string);
/**
* Array of JSON objects to convert
* @default [{"name": "John", "age": "30"}]
*/
json: T[];
/**
* Headers to use (in order)
* @default ["name", "age"]
*/
headers: string[];
/**
* Whether to include headers in output
* @default true
*/
includeHeaders?: boolean;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
}
class JsonToCsvAutoDto<T = Record<string, unknown>> {
constructor(json?: T[], includeHeaders?: boolean, rowSeparator?: string, columnSeparator?: string);
/**
* Array of JSON objects to convert
* @default [{"name": "John", "age": "30"}]
*/
json: T[];
/**
* Whether to include headers in output
* @default true
*/
includeHeaders?: boolean;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
}
class GetHeadersDto {
constructor(csv?: string, headerRow?: number, rowSeparator?: string, columnSeparator?: string);
/**
* CSV text to get headers from
* @default name,age\nJohn,30
*/
csv: string;
/**
* Row index where headers are located
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
headerRow?: number;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
}
class GetRowCountDto {
constructor(csv?: string, hasHeaders?: boolean, dataStartRow?: number, rowSeparator?: string, columnSeparator?: string);
/**
* CSV text to count rows
* @default name,age\nJohn,30\nJane,25
*/
csv: string;
/**
* Whether CSV has headers
* @default true
*/
hasHeaders?: boolean;
/**
* Row index where data starts (overrides hasHeaders if set)
* @minimum 0
* @maximum Infinity
* @step 1
*/
dataStartRow?: number;
/**
* Row separator (newline character)
* @default \n
*/
rowSeparator?: string;
/**
* Column separator (delimiter)
* @default ,
*/
columnSeparator?: string;
}
}