uuid-validate
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/uuid-validate package

0.0.3 • Public • Published

uuid-validator

Build Status

Useful little package to validate UUIDs in Node.js. Usage:

var validate = require('uuid-validate');
 
// Let's validate a uuid version 1. If we don't pass a version, it'll
// infer it based on the uuid itself.
validate('95ecc380-afe9-11e4-9b6c-751b66dd541e'); // => true
 
// We can tell it what version to expect, and if it gets the wrong
// version, it'll return false.
validate('95ecc380-afe9-11e4-9b6c-751b66dd541e', 1); // => true (it's version 1)
validate('95ecc380-afe9-11e4-9b6c-751b66dd541e', 4); // => false (it's not version 4)
 
// You can also pass buffers instead of strings.
// This works for UUID versions 1 through 4
 
// If you want to find out what version a UUID is:
validate.version('95ecc380-afe9-11e4-9b6c-751b66dd541e'); // => 1

Readme

Keywords

Package Sidebar

Install

npm i uuid-validate

Weekly Downloads

120,638

Version

0.0.3

License

MIT

Unpacked Size

6.99 kB

Total Files

6

Last publish

Collaborators

  • connor.peet