DefinitelyTyped/types/csvrow/index.d.ts
CodeAnimal 14dd64b8cb Add csvrow 0.1 (#20614)
* Add csvrow 0.1 definitions

* Fix dtslint errors

* add newline to end of index.d.ts

* Update tsconfig.json

Set `"strictFunctionTypes"` to `true`
2017-10-17 09:02:32 -07:00

30 lines
854 B
TypeScript

// Type definitions for csvrow 0.1
// Project: https://github.com/trentm/node-csvrow
// Definitions by: Peter Harris <https://github.com/codeanimal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Parse a CSV row (i.e. a single row) into an array of strings.
*
* c.f. http://en.wikipedia.org/wiki/Comma-separated_values
*
* Limitations/Opinions:
* - don't support elements with line-breaks
* - leading a trailing spaces are trimmed, unless the entry is quoted
*
* @throws {TypeError} if the given CSV row is invalid
*
* @summary Parse a CSV row into an array of strings.
*/
export function parse(row: string): string[];
/**
* Serialize the given array to a CSV row.
*/
export function stringify(columns: string[]): string;
/**
* Normalize the given CSV line.
*/
export function normalize(row: string): string;