Add a new type definition for Randomstring (#9252)

* Create randomstring-tests.ts

* Create randomstring.d.ts
This commit is contained in:
Isman Usoh
2016-05-09 15:38:42 +07:00
committed by Horiuchi_H
parent d9e73fad7d
commit b332be4e13
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
/// <reference path="randomstring.d.ts" />
import * as randomstring from "randomstring";
randomstring.generate();
randomstring.generate(24);
randomstring.generate({
length: 12,
readable: true,
capitalization: "",
charset: "alphabetic"
});
randomstring.generate({
charset: "abc"
});

19
randomstring/randomstring.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
// Type definitions for randomstring 1.1.4
// Project: https://github.com/klughammer/node-randomstring
// Definitions by: Isman Usoh <https://github.com/isman-usoh/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Randomstring {
interface GenerateOptions {
length?: number;
readable?: boolean;
charset?: string;
capitalization?: string;
}
function generate(options?: GenerateOptions): string;
}
declare module "randomstring" {
export = Randomstring;
}