# @helpers4/id

> Tree-shakable TypeScript utility functions for the `id` domain.
> Package: `@helpers4/id` — Version: 2.0.4
> License: LGPL-3.0-or-later

## Installation

```sh
npm install @helpers4/id
# or
pnpm add @helpers4/id
```

## Usage

```typescript
import { uuid7 } from '@helpers4/id';
```

## Functions

| Function | Description |
|---|---|
| `uuid7` | Generates a UUID v7 string (RFC 9562). UUID v7 embeds a Unix timestamp in milliseconds, making it ch |

---

## API Reference

### `uuid7`

Generates a UUID v7 string (RFC 9562).
UUID v7 embeds a Unix timestamp in milliseconds, making it
chronologically sortable while retaining randomness.

```typescript
import { uuid7 } from '@helpers4/id';

uuid7(): string
```

**Returns:** `string` — A UUID v7 string in the format `xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx`

**Examples:**

*Generate a UUID v7*

Produces a RFC 9562 UUID v7 string with an embedded millisecond timestamp.

```typescript
uuid7()
// => "019077e0-5c70-7b3a-8a1f-3e4d5b6c7d8e"
```

*UUIDs are chronologically sortable*

UUID v7 values generated later are lexicographically greater, making them ideal for database primary keys.

```typescript
const id1 = uuid7();
// ... later ...
const id2 = uuid7();
id1 < id2 // => true
```

*Each UUID is unique*

No two calls produce the same value.

```typescript
uuid7() !== uuid7() // => true
```

---
