mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-15 17:47:49 +08:00
Merge pull request #6342 from chrootsu/iniparser
iniparser: definition of the module has been added
This commit is contained in:
21
iniparser/iniparser-tests.ts
Normal file
21
iniparser/iniparser-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference path="iniparser.d.ts" />
|
||||
|
||||
import * as iniparser from 'iniparser';
|
||||
|
||||
type Result = {section: {param: string}};
|
||||
|
||||
let file: string;
|
||||
|
||||
{
|
||||
let callback: (err: any, data: Result) => void;
|
||||
let result: void;
|
||||
|
||||
iniparser.parse(file, callback);
|
||||
}
|
||||
|
||||
{
|
||||
let result: Result;
|
||||
|
||||
result = iniparser.parseSync<Result>(file);
|
||||
result = iniparser.parseString<Result>('');
|
||||
}
|
||||
15
iniparser/iniparser.d.ts
vendored
Normal file
15
iniparser/iniparser.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for iniparser
|
||||
// Project: https://github.com/shockie/node-iniparser
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "iniparser" {
|
||||
export function parse<T>(
|
||||
file: string,
|
||||
callback: (err: any, data: T) => void
|
||||
): void;
|
||||
|
||||
export function parseSync<T>(file: string): T;
|
||||
|
||||
export function parseString<T>(data: string): T;
|
||||
}
|
||||
Reference in New Issue
Block a user