mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
uuid-apikey type definitions (#41527)
* initial commit * Testing * headers * header fixes
This commit is contained in:
committed by
Eli Barzilay
parent
28897f7536
commit
7ecea94027
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for uuid-apikey 1.4
|
||||
// Project: https://github.com/chronosis/uuid-apikey
|
||||
// Definitions by: Ben Allfree <https://github.com/benallfree>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface UUIDOptions {
|
||||
noDashes: boolean;
|
||||
}
|
||||
|
||||
export interface ApiKeyInfo {
|
||||
uuid: string;
|
||||
apiKey: string;
|
||||
}
|
||||
|
||||
declare class UUIDAPIKey {
|
||||
checkDashes(positions: number[], str: string): boolean;
|
||||
|
||||
isUUID(uuid: string): boolean;
|
||||
|
||||
isAPIKey(apiKey: string): boolean;
|
||||
|
||||
toAPIKey(uuid: string, options?: Partial<UUIDOptions>): string;
|
||||
|
||||
toUUID(apiKey: string): string;
|
||||
|
||||
check(apiKey: string, uuid: string): boolean;
|
||||
|
||||
create(options?: Partial<UUIDOptions>): ApiKeyInfo;
|
||||
}
|
||||
|
||||
declare let obj: UUIDAPIKey;
|
||||
|
||||
export default obj;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"uuid-apikey-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,5 @@
|
||||
import uuidApiKey from 'uuid-apikey';
|
||||
|
||||
const info = uuidApiKey.create();
|
||||
const isValid = uuidApiKey.check(info.apiKey, info.uuid);
|
||||
// true
|
||||
Reference in New Issue
Block a user