RegExp free UUID validator
npm install string-is-uuidstring-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.
sh
npm install string-is-uuid
`
Usage
`js
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%.