mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 06:17:04 +00:00
Merge pull request #17992 from cjbarth/uuid/v3
Add support for v5 of node-uuid
This commit is contained in:
Vendored
+7
-2
@@ -1,10 +1,15 @@
|
||||
// Type definitions for uuid 3.0
|
||||
// Project: https://github.com/defunctzombie/node-uuid
|
||||
// Type definitions for uuid 3.4
|
||||
// Project: https://github.com/kelektiv/node-uuid
|
||||
// Definitions by: Oliver Hoffmann <https://github.com/iamolivinius/>
|
||||
// Felipe Ochoa <https://github.com/felipeochoa/>
|
||||
// Chris Barth <https://github.com/cjbarth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
// The version number has been artificially set to 3.4, instead of 3.0,
|
||||
// because of the existing uuid-js npm types package being at 3.3.28,
|
||||
// meaning that `npm install @types/uuid` was installing the typings for uuid-js, not this
|
||||
|
||||
import { v1, v4 } from './interfaces';
|
||||
|
||||
interface UuidStatic {
|
||||
|
||||
Vendored
+4
@@ -19,3 +19,7 @@ export type v1 = v1String & v1Buffer;
|
||||
export type v4String = (options?: V4Options) => string;
|
||||
export type v4Buffer = <T extends OutputBuffer>(options: V4Options | null | undefined, buffer: T, offset?: number) => T;
|
||||
export type v4 = v4String & v4Buffer;
|
||||
|
||||
export type v5String = (name: string | number[], namespace: string | number[]) => string;
|
||||
export type v5Buffer = <T extends OutputBuffer>(name: string | number[], namespace: string | number[], buffer: T, offset?: number) => T;
|
||||
export type v5 = v5String & v5Buffer;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"index.d.ts",
|
||||
"v1.d.ts",
|
||||
"v4.d.ts",
|
||||
"v5.d.ts",
|
||||
"interfaces.d.ts",
|
||||
"uuid-tests.ts"
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import uuid = require('uuid');
|
||||
import v1 = require('uuid/v1');
|
||||
import v4 = require('uuid/v4');
|
||||
import v5 = require('uuid/v5');
|
||||
|
||||
let uuidv1: string = uuid.v1();
|
||||
|
||||
@@ -41,3 +42,9 @@ bufferv4 = uuid(undefined, bufferv4);
|
||||
bufferv4 = uuid(null, bufferv4, 16);
|
||||
bufferv4 = v4(null, bufferv4);
|
||||
bufferv4 = v4(undefined, bufferv4, 16);
|
||||
|
||||
const MY_NAMESPACE = v4();
|
||||
const a: string = v5('hello', MY_NAMESPACE);
|
||||
const b: string = v5('world', MY_NAMESPACE);
|
||||
const c: Buffer = v5('world', MY_NAMESPACE, new Buffer(16));
|
||||
const d: number[] = v5('world', MY_NAMESPACE, [], 0);
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import { v5 } from './interfaces';
|
||||
|
||||
declare const v5: v5;
|
||||
|
||||
export = v5;
|
||||
Reference in New Issue
Block a user