mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Add declarations for coverup
This commit is contained in:
parent
f0b1bb2464
commit
6db5641a3e
32
types/coverup/coverup-tests.ts
Normal file
32
types/coverup/coverup-tests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import coverup = require("coverup");
|
||||
|
||||
coverup("4242-4242-4242-4242"); // $ExpectType string
|
||||
//=> *******************
|
||||
|
||||
coverup("4242-4242-4242-4242", { char: "%" }); // $ExpectType string
|
||||
//=> %%%%%%%%%%%%%%%%%%%
|
||||
|
||||
coverup("4242-4242-4242-4242", { keepSymbols: true }); // $ExpectType string
|
||||
//=> ****-****-****-****
|
||||
|
||||
coverup("4242-4242-4242-4242", { keepLeft: 1, keepRight: 1, compactTo: 4 }); // $ExpectType string
|
||||
//=> 4****2
|
||||
|
||||
coverup("4242-4242-4242-4242", { keepLeft: 4 }); // $ExpectType string
|
||||
//=> 4242***************
|
||||
|
||||
coverup("4242-4242-4242-4242", { keepRight: 4 }); // $ExpectType string
|
||||
//=> ***************4242
|
||||
|
||||
let options: coverup.Options = {
|
||||
char: "x",
|
||||
keepLeft: 3,
|
||||
keepRight: 3,
|
||||
};
|
||||
|
||||
coverup("4242-4242-4242-4242", options); // $ExpectType string
|
||||
// => 424xxxxxxxxxxxxx242
|
||||
|
||||
coverup("4242-4242-4242-4242", { keepLeft: 1, keepRight: 1, compactTo: 4, keepSymbols: true }); // $ExpectError
|
||||
//=> Error: you cannot define both compactTo and keepSymbols
|
||||
|
||||
20
types/coverup/index.d.ts
vendored
Normal file
20
types/coverup/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for coverup v0.1
|
||||
// Project: https://github.com/jsonmaur/coverup
|
||||
// Definitions by: Vadim Belorussov <https://github.com/bevalorous>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace Coverup;
|
||||
|
||||
export = coverup;
|
||||
|
||||
declare function coverup(value: string, options?: coverup.Options): string;
|
||||
|
||||
declare namespace coverup {
|
||||
export interface Options {
|
||||
char?: string;
|
||||
keepLeft?: number;
|
||||
keepRight?: number;
|
||||
compactTo?: number;
|
||||
keepSymbols?: boolean;
|
||||
}
|
||||
}
|
||||
22
types/coverup/tsconfig.json
Normal file
22
types/coverup/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"coverup-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/coverup/tslint.json
Normal file
1
types/coverup/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user