# @minecraft-js/uuid

> Serialize, deserialize and generate UUIDs in JavaScript

Latest version **1.0.3** (published 2022-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @minecraft-js/uuid
pnpm add @minecraft-js/uuid
yarn add @minecraft-js/uuid
bun add @minecraft-js/uuid
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-08-28 |
| First published | 2022-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18.x |
| Dependencies | 0 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | RichardDorian |
| Maintainers | richarddorian |
| Keywords | minecraftjs |

## Links

- npm: https://www.npmjs.com/package/@minecraft-js/uuid
- Repository: https://github.com/MinecraftJS/uuid
- Homepage: https://github.com/MinecraftJS/uuid#readme
- Issues: https://github.com/MinecraftJS/uuid/issues
- npm.io page: https://npm.io/package/@minecraft-js/uuid

## Recent versions

- 1.0.3 (latest) — 2022-08-28
- 1.0.2 — 2022-08-28
- 1.0.1 — 2022-08-28
- 1.0.0 — 2022-08-27

## README

# uuid

Serialize, deserialize and generate UUIDs in JavaScript

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/uuid
```

And then import it in your JavaScript/TypeScript file

```ts
const { UUID } = require('@minecraft-js/uuid'); // CommonJS

import { UUID } from '@minecraft-js/uuid'; // ES6
```

## Generating an UUID

To generate an UUID use the `generateV4` function that you can import from the package.

```ts
const uuid = generateV4();

console.log(uuid); // 'UUID <7ed9e77e-34b8-400e-b684-9093c550b4f9>'
```

## Parsing an UUID

If you need to parse UUIDs easily from a string (with dashes or not, both are supported) use the `parseUUID` function.

```ts
const parsed = parseUUID('7ed9e77e-34b8-400e-b684-9093c550b4f9');

console.log(uuid); // 'UUID <7ed9e77e-34b8-400e-b684-9093c550b4f9>'
```

The parseUUID runs a check to see whether or not the string is a valid UUID before parsing it. If you are 100% sure that the string is a valid UUID you could set the `disableTypeCheck` argument to true to skip that check and makes the function very fast.

```ts
const parsed = parseUUID('7ed9e77e-34b8-400e-b684-9093c550b4f9', true);

console.log(uuid); // 'UUID <7ed9e77e-34b8-400e-b684-9093c550b4f9>'
```

See more here: https://minecraftjs.github.io/uuid/

---
_Source: https://npm.io/package/@minecraft-js/uuid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
