Skip to content

do-/node-string-is-uuid

Repository files navigation

workflow Jest coverage

string-is-uuid is a UUID validator for node.js.

It offers a single function, isUuid (), that does just the same as the version () function from uuid package.

Installation

npm install string-is-uuid

Usage

const {isUuid} = require ('string-is-uuid')

try {
  const version = isUuid (presumedUUID)
  // console.log (`OK, this really is a UUID, ver. #${version}`)
}
catch (err) {
  // console.log (err)
}

Rationale

There are plenty of UUID validators available on npm. Still, every one of them the author checked out to date is implemented via regular expressions, that impose a certain performance overhead.

For example, as benchmarks show, the aforementioned version ()'s latency from uuid v.11.1.0 can be reduced by 78%.

About

RegExp free UUID validator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published