# chai-uuid

> Chai plugin for performing assertions on UUIDs

Latest version **1.0.6** (published 2017-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install chai-uuid
pnpm add chai-uuid
yarn add chai-uuid
bun add chai-uuid
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2017-06-13 |
| First published | 2017-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/chai-uuid) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Ryan French |
| Maintainers | rfrench |
| Keywords | chai, plugin, uuid, expect, should, guid, chai-plugin, browser |

## Links

- npm: https://www.npmjs.com/package/chai-uuid
- Repository: https://github.com/rfrench/chai-uuid
- Homepage: https://github.com/rfrench/chai-uuid#readme
- Issues: https://github.com/rfrench/chai-uuid/issues
- npm.io page: https://npm.io/package/chai-uuid

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2017-06-13
- 1.0.5 — 2017-06-12
- 1.0.4 — 2017-06-12
- 1.0.3 — 2017-06-11
- 1.0.2 — 2017-06-10

## README

# chai-uuid
Chai plugin for performing assertions on UUIDs

## Install
```bash
$ npm install chai-uuid
```

## Example
Use the `uuid` or `guid` method to test whether the assertion is a valid UUID.

```javascript
const chai = require("chai");
chai.use(require('chai-uuid'));
```

## Expect
```javascript
const chai = require("chai");
chai.use(require('chai-uuid'));
const expect = chai.expect;

// validate UUID v1
expect('bd74c8da-4d9e-11e7-b114-b2f933d5fe66').to.be.a.uuid('v1');
// validate UUID v2
expect('f6b93689-1c6a-2931-a785-c7d5606f7f4d').to.be.a.uuid('v2');
// validate UUID v3
expect('622ab4f8-c3e7-3747-a548-0e2d11bf5ab1').to.be.a.uuid('v3');
// validate UUID v4
expect('0ce529f4-8854-41ec-b67c-fbcb4e716e42').to.be.a.uuid('v4');
// validate UUID v5
expect('48a698a0-1641-5aca-bc1b-de9b1a482ee1').to.be.a.uuid('v5');
// validate UUID (any version)
expect('a416d989-91d1-48c9-b583-267df138834c').to.be.a.uuid();

// optionally, you can use the guid method
expect('a416d989-91d1-48c9-b583-267df138834c').to.be.a.guid();
```

## Should
```javascript
const chai = require("chai");
chai.use(require('chai-uuid'));
const should = chai.should();

// validate UUID v1
'bd74c8da-4d9e-11e7-b114-b2f933d5fe66'.should.be.a.uuid('v1');

// validate GUID
'bd74c8da-4d9e-11e7-b114-b2f933d5fe66'.should.be.a.guid();
```

## Assert
```javascript
const chai = require("chai");
chai.use(require('chai-uuid'));
const assert = chai.assert;

// validate UUID v1
assert.uuid('bd74c8da-4d9e-11e7-b114-b2f933d5fe66', 'v1');

// validate GUID
assert.guid('bd74c8da-4d9e-11e7-b114-b2f933d5fe66');
```

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