env-to-object: fix 2nd argument

Official README is wrong.
This commit is contained in:
TANAKA Koichi 2017-02-05 19:23:34 +09:00
parent 6435478e4d
commit 0a4823399e
2 changed files with 10 additions and 4 deletions

View File

@ -26,8 +26,10 @@ const map = {
const result1:any = envToObject(map);
const result2:any = envToObject(map, {
'my-custom-type': (str: string, opts: any) => {
let foo: any = JSON.parse(str);
return foo;
parsers: {
'my-custom-type': (str: string, opts: any) => {
let foo: any = JSON.parse(str);
return foo;
}
}
});

View File

@ -29,7 +29,11 @@ declare namespace env {
export interface Parsers {
[parserName: string]: (str: string, opts: any) => any;
}
export interface Options {
parsers: Parsers;
}
}
declare function env(map: env.Mappings, parsers?: env.Parsers): any;
declare function env(map: env.Mappings, options?: env.Options): any;
export = env;