@grnsft/if
Version:
Impact Framework
27 lines (26 loc) • 831 B
TypeScript
/**
* Checks if given string is URL.
*/
export declare const isURL: (filepath: string) => boolean;
/**
* Checks if given `filepath` is url, then tries to fetch it.
* Otherwise tries to read file.
*/
export declare const retrieveFile: (filepath: string) => Promise<any>;
/**
* Checks if value is invalid: `undefined`, `null` or an empty string, then sets `nan` instead.
*/
export declare const setNanValue: (value: any) => any;
/**
* Converts empty values to `nan`.
*/
export declare const nanifyEmptyValues: (object: any) => any;
/**
* If `field` is missing from `object`, then reject with error.
* Otherwise nanify empty values and return data.
*/
export declare const fieldAccessor: (field: string, object: any) => any;
/**
* Parses CSV file.
*/
export declare const parseCSVFile: (file: string | Buffer) => any[];