New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →

uuid

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid - npm Package Compare versions

Comparing version

to
11.1.0

@@ -1,2 +0,2 @@

export type UUIDTypes = string | Uint8Array;
export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
export type Version1Options = {

@@ -3,0 +3,0 @@ node?: Uint8Array;

@@ -9,4 +9,4 @@ import { Version1Options } from './types.js';

declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
declare function v1(options: Version1Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
export default v1;

@@ -25,3 +25,3 @@ "use strict";

}
return buf ? bytes : (0, stringify_js_1.unsafeStringify)(bytes);
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
}

@@ -28,0 +28,0 @@ function updateV1State(state, now, rnds) {

import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v3 {

@@ -6,0 +6,0 @@ var DNS: string;

@@ -6,3 +6,3 @@ import { UUIDTypes } from './types.js';

type HashFunction = (bytes: Uint8Array) => Uint8Array;
export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array;
export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
export {};
import { Version4Options } from './types.js';
declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
declare function v4(options: Version4Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v4;
import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v5 {

@@ -6,0 +6,0 @@ var DNS: string;

import { Version6Options } from './types.js';
declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
declare function v6(options: Version6Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v6;

@@ -7,4 +7,4 @@ import { Version7Options } from './types.js';

declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
declare function v7(options: Version7Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
export default v7;

@@ -18,3 +18,3 @@ "use strict";

}
return buf ? bytes : (0, stringify_js_1.unsafeStringify)(bytes);
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
}

@@ -21,0 +21,0 @@ function updateV7State(state, now, rnds) {

@@ -1,2 +0,2 @@

export type UUIDTypes = string | Uint8Array;
export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
export type Version1Options = {

@@ -3,0 +3,0 @@ node?: Uint8Array;

@@ -9,4 +9,4 @@ import { Version1Options } from './types.js';

declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
declare function v1(options: Version1Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
export default v1;

@@ -25,3 +25,3 @@ "use strict";

}
return buf ? bytes : (0, stringify_js_1.unsafeStringify)(bytes);
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
}

@@ -28,0 +28,0 @@ function updateV1State(state, now, rnds) {

import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v3 {

@@ -6,0 +6,0 @@ var DNS: string;

@@ -6,3 +6,3 @@ import { UUIDTypes } from './types.js';

type HashFunction = (bytes: Uint8Array) => Uint8Array;
export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array;
export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
export {};
import { Version4Options } from './types.js';
declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
declare function v4(options: Version4Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v4;
import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v5 {

@@ -6,0 +6,0 @@ var DNS: string;

import { Version6Options } from './types.js';
declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
declare function v6(options: Version6Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v6;

@@ -7,4 +7,4 @@ import { Version7Options } from './types.js';

declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
declare function v7(options: Version7Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
export default v7;

@@ -18,3 +18,3 @@ "use strict";

}
return buf ? bytes : (0, stringify_js_1.unsafeStringify)(bytes);
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
}

@@ -21,0 +21,0 @@ function updateV7State(state, now, rnds) {

@@ -1,2 +0,2 @@

export type UUIDTypes = string | Uint8Array;
export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
export type Version1Options = {

@@ -3,0 +3,0 @@ node?: Uint8Array;

@@ -9,4 +9,4 @@ import { Version1Options } from './types.js';

declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
declare function v1(options: Version1Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
export default v1;

@@ -22,3 +22,3 @@ import rng from './rng.js';

}
return buf ? bytes : unsafeStringify(bytes);
return buf ?? unsafeStringify(bytes);
}

@@ -25,0 +25,0 @@ export function updateV1State(state, now, rnds) {

import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v3 {

@@ -6,0 +6,0 @@ var DNS: string;

@@ -6,3 +6,3 @@ import { UUIDTypes } from './types.js';

type HashFunction = (bytes: Uint8Array) => Uint8Array;
export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array;
export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
export {};
import { Version4Options } from './types.js';
declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
declare function v4(options: Version4Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v4;
import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v5 {

@@ -6,0 +6,0 @@ var DNS: string;

import { Version6Options } from './types.js';
declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
declare function v6(options: Version6Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v6;

@@ -7,4 +7,4 @@ import { Version7Options } from './types.js';

declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
declare function v7(options: Version7Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
export default v7;

@@ -15,3 +15,3 @@ import rng from './rng.js';

}
return buf ? bytes : unsafeStringify(bytes);
return buf ?? unsafeStringify(bytes);
}

@@ -18,0 +18,0 @@ export function updateV7State(state, now, rnds) {

@@ -1,2 +0,2 @@

export type UUIDTypes = string | Uint8Array;
export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
export type Version1Options = {

@@ -3,0 +3,0 @@ node?: Uint8Array;

@@ -9,4 +9,4 @@ import { Version1Options } from './types.js';

declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
declare function v1(options: Version1Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
export default v1;

@@ -22,3 +22,3 @@ import rng from './rng.js';

}
return buf ? bytes : unsafeStringify(bytes);
return buf ?? unsafeStringify(bytes);
}

@@ -25,0 +25,0 @@ export function updateV1State(state, now, rnds) {

import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v3 {

@@ -6,0 +6,0 @@ var DNS: string;

@@ -6,3 +6,3 @@ import { UUIDTypes } from './types.js';

type HashFunction = (bytes: Uint8Array) => Uint8Array;
export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array;
export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
export {};
import { Version4Options } from './types.js';
declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
declare function v4(options: Version4Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v4;
import { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf: Uint8Array, offset?: number): Uint8Array;
declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
declare namespace v5 {

@@ -6,0 +6,0 @@ var DNS: string;

import { Version6Options } from './types.js';
declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
declare function v6(options: Version6Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v6;

@@ -7,4 +7,4 @@ import { Version7Options } from './types.js';

declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
declare function v7(options: Version7Options | undefined, buf: Uint8Array, offset?: number): Uint8Array;
declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
export default v7;

@@ -15,3 +15,3 @@ import rng from './rng.js';

}
return buf ? bytes : unsafeStringify(bytes);
return buf ?? unsafeStringify(bytes);
}

@@ -18,0 +18,0 @@ export function updateV7State(state, now, rnds) {

{
"name": "uuid",
"version": "11.0.5",
"version": "11.1.0",
"description": "RFC9562 UUIDs",

@@ -5,0 +5,0 @@ "type": "module",

@@ -5,5 +5,5 @@ <!--

# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser)
# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions/workflows/browser.yml)
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formally [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formerly [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs

@@ -13,13 +13,13 @@ - **Complete** - Support for all RFC9562 UUID versions

- ESM & Common JS
- [Chrome, Safari, Firefox, Edge browsers](#support)
- [Typescript](#support)
- [Chrome, Safari, Firefox, and Edge](#support)
- [NodeJS](#support)
- [React Native / Expo](#react-native--expo)
- **Secure** - Cryptographically-strong random values
- **Compact** - No dependencies, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)
- **CLI** - Includes the [`uuid` command line](#command-line) utility
- **Typescript** - Types now included
- **Secure** - Uses modern `crypto` API for random values
- **Compact** - Zero-dependency, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)
- **CLI** - [`uuid` command line](#command-line) utility
<!-- prettier-ignore -->
> [!NOTE]
w> `uuid@11` is now available: See the [CHANGELOG](./CHANGELOG.md) for details. TL;DR:
> `uuid@11` is now available: See the [CHANGELOG](./CHANGELOG.md) for details. TL;DR:
> * TypeScript support is now included (remove `@types/uuid` from your dependencies)

@@ -185,3 +185,3 @@ > * Subtle changes to how the `options` arg is interpreted for `v1()`, `v6()`, and `v7()`. [See details](#options-handling-for-timestamp-uuids)

| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |

@@ -250,3 +250,3 @@ | _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |

| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |

@@ -299,3 +299,3 @@ | _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |

| `namespace` | `String \| Array[16]` Namespace UUID |
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |

@@ -375,3 +375,3 @@ | _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |

| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |

@@ -378,0 +378,0 @@ | _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |