mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Add a new type definition for Randomstring (#9252)
* Create randomstring-tests.ts * Create randomstring.d.ts
This commit is contained in:
18
randomstring/randomstring-tests.ts
Normal file
18
randomstring/randomstring-tests.ts
Normal 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
19
randomstring/randomstring.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user