-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3bef08
commit 9fc76d6
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,93 @@ | ||
define module 'csv-string'; | ||
declare module "csv-string" { | ||
import { Transform } from "stream"; | ||
|
||
namespace CsvString { | ||
type rowElement = string | number | boolean; | ||
|
||
type row = rowElement[]; | ||
|
||
type separator = "," | ";" | "|" | "\t"; | ||
|
||
function parse(input: string, separator?: separator, quote?: string): row; | ||
|
||
function stringify(input: row, separator?: string): string; | ||
|
||
function detect(input: string): separator; | ||
|
||
function createStream(options?: { | ||
separator: separator; | ||
quote: string; | ||
}): Transform; | ||
|
||
type forEachCallback = (row: row, index: number) => undefined; | ||
|
||
function forEach( | ||
input: string, | ||
separator: string, | ||
quote: string, | ||
callback: forEachCallback | ||
): void; | ||
|
||
function forEach( | ||
input: string, | ||
separator: string, | ||
callback: forEachCallback | ||
): void; | ||
|
||
function forEach(input: string, callback: forEachCallback): void; | ||
|
||
type readCallback = (row: row) => undefined; | ||
|
||
function read( | ||
input: string, | ||
separator: string, | ||
quote: string, | ||
callback: readCallback | ||
): number; | ||
|
||
function read( | ||
input: string, | ||
separator: string, | ||
callback: readCallback | ||
): number; | ||
|
||
function read(input: string, callback: readCallback): number; | ||
|
||
type readAllCallback = readCallback; | ||
|
||
function readAll( | ||
input: string, | ||
separator: string, | ||
quote: string, | ||
callback: readCallback | ||
): number; | ||
|
||
function readAll( | ||
input: string, | ||
separator: string, | ||
callback: readCallback | ||
): number; | ||
|
||
function readAll(input: string, callback: readCallback): number; | ||
|
||
type readChunkCallback = readCallback; | ||
|
||
function readChunk( | ||
input: string, | ||
separator: string, | ||
quote: string, | ||
callback: readCallback | ||
): number; | ||
|
||
function readChunk( | ||
input: string, | ||
separator: string, | ||
callback: readCallback | ||
): number; | ||
|
||
function readChunk(input: string, callback: readCallback): number; | ||
} | ||
|
||
export = CsvString; | ||
} |