mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
Merge pull request #18018 from HiromiShikata/feature/create-uuid-validate
Added definitioin for uuid-validate
This commit is contained in:
10
types/uuid-validate/index.d.ts
vendored
Normal file
10
types/uuid-validate/index.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// Type definitions for uuid-validate 0.0
|
||||
// Project: https://github.com/mixer/uuid-validate
|
||||
// Definitions by: Hiromi Shikata <https://github.com/HiromiShikata>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function validate(uuid: string, version?: number): boolean;
|
||||
declare namespace validate {
|
||||
function version(uuid: string): number;
|
||||
}
|
||||
export = validate;
|
||||
23
types/uuid-validate/tsconfig.json
Normal file
23
types/uuid-validate/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"uuid-validate-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/uuid-validate/tslint.json
Normal file
1
types/uuid-validate/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
6
types/uuid-validate/uuid-validate-tests.ts
Normal file
6
types/uuid-validate/uuid-validate-tests.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import validate = require('uuid-validate');
|
||||
|
||||
console.log(validate('95ecc380-afe9-11e4-9b6c-751b66dd541e')); // => true
|
||||
console.log(validate('95ecc380-afe9-11e4-9b6c-751b66dd541e', 1)); // => true (it's version 1)
|
||||
console.log(validate('95ecc380-afe9-11e4-9b6c-751b66dd541e', 4)); // => false (it's not version 4)
|
||||
console.log(validate.version('95ecc380-afe9-11e4-9b6c-751b66dd541e')); // => 1
|
||||
Reference in New Issue
Block a user