Merge pull request #18018 from HiromiShikata/feature/create-uuid-validate

Added definitioin for uuid-validate
This commit is contained in:
Ryan Cavanaugh
2017-07-13 11:11:02 -07:00
committed by GitHub
4 changed files with 40 additions and 0 deletions

10
types/uuid-validate/index.d.ts vendored Normal file
View 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;

View 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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View 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