mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
Added type definitions for voucher-code-generator
This commit is contained in:
19
types/voucher-code-generator/index.d.ts
vendored
Normal file
19
types/voucher-code-generator/index.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Type definitions for voucher-code-generator 1.1
|
||||
// Project: http://www.voucherify.io/
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/*~ If this module has methods, declare them as functions like so.
|
||||
*/
|
||||
export function charset(name: "numbers" | "alphabetic" | "alphanumeric"): string;
|
||||
export function generate(config?: generatorConfig): string[];
|
||||
|
||||
/*~ You can declare types that are available via importing the module */
|
||||
export interface generatorConfig {
|
||||
length?: number;
|
||||
count?: number;
|
||||
charset?: string;
|
||||
prefix?: string;
|
||||
postfix?: string;
|
||||
pattern?: string;
|
||||
}
|
||||
23
types/voucher-code-generator/tsconfig.json
Normal file
23
types/voucher-code-generator/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"voucher-code-generator-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/voucher-code-generator/tslint.json
Normal file
1
types/voucher-code-generator/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
18
types/voucher-code-generator/voucher-code-generator-tests.ts
Normal file
18
types/voucher-code-generator/voucher-code-generator-tests.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import voucherGenerator = require('voucher-code-generator');
|
||||
import { generatorConfig } from 'voucher-code-generator';
|
||||
|
||||
const config: generatorConfig = {
|
||||
length: 6,
|
||||
count: 3,
|
||||
charset: "0123456789",
|
||||
prefix: "offer-",
|
||||
postfix: "-2019",
|
||||
pattern: "######"
|
||||
};
|
||||
|
||||
voucherGenerator.charset('numbers');
|
||||
voucherGenerator.charset('alphabetic');
|
||||
voucherGenerator.charset('alphanumeric');
|
||||
|
||||
voucherGenerator.generate();
|
||||
voucherGenerator.generate(config);
|
||||
Reference in New Issue
Block a user