-
Notifications
You must be signed in to change notification settings - Fork 361
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
Mizunashi Mana
authored and
Ilya Radchenko
committed
Dec 8, 2016
1 parent
2c42001
commit fae53a1
Showing
1 changed file
with
24 additions
and
11 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,14 +1,25 @@ | ||
declare namespace json2csv { | ||
interface IField { | ||
interface FieldValueCallback<T> { | ||
(row: T, field: string, data: string): string; | ||
} | ||
|
||
interface FieldBase { | ||
label?: string; | ||
value: string; | ||
default?: string; | ||
} | ||
|
||
interface IOptions { | ||
data: any[]; | ||
fields?: (string | IField)[]; | ||
filedNames?: string[]; | ||
interface Field extends FieldBase { | ||
value: string; | ||
} | ||
|
||
interface CallbackField<T> extends FieldBase { | ||
value: FieldValueCallback<T>; | ||
} | ||
|
||
interface Options<T> { | ||
data: T[]; | ||
fields?: (string | Field | CallbackField<T>)[]; | ||
fieldNames?: string[]; | ||
del?: string; | ||
defaultValue?: string; | ||
quotes?: string; | ||
|
@@ -22,12 +33,14 @@ declare namespace json2csv { | |
includeEmptyRows?: boolean; | ||
} | ||
|
||
interface ICallback { | ||
interface Callback { | ||
(error: Error, csv: string): void; | ||
} | ||
|
||
export function json2csv(options: IOptions, callback: ICallback): void; | ||
export function json2csv(options: IOptions): string; | ||
} | ||
|
||
export = json2csv.json2csv; | ||
declare function json2csv<T>(options: json2csv.Options<T>, callback: json2csv.Callback): void; | ||
declare function json2csv<T>(options: json2csv.Options<T>): string; | ||
declare function json2csv(options: json2csv.Options<{ [key: string]: string; }>, callback: json2csv.Callback): void; | ||
declare function json2csv(options: json2csv.Options<{ [key: string]: string; }>): string; | ||
|
||
export = json2csv; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
knownasilya
Collaborator
|
why not es6 modules like
export default json2csv
Atm there is not import: