npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chai-uuid

v1.0.6

Published

Chai plugin for performing assertions on UUIDs

Downloads

231,937

Readme

chai-uuid

Chai plugin for performing assertions on UUIDs

Install

$ npm install chai-uuid

Example

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

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

Expect

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

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

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');