microsoft / uuid-validate Goto Github PK
View Code? Open in Web Editor NEWJavascript validator for UUID versions 1 through 5
License: MIT License
Javascript validator for UUID versions 1 through 5
License: MIT License
Testing these two uuid's returns false:
Whereas
!/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test('c9cfe3e0-e298-7a36-9c88-7c2acf143bab')
is true.
Above test from here: https://stackoverflow.com/a/13653180/712005
See live example here: https://codesandbox.io/s/empty-wind-11jxf
I've found an instance of a valid v3 uuid that gets identified as non valid, 4810935e-168b-3d7d-7a42-081999ff18bb. I've checked multiple tools and all seem to agree that this is indeed a valid uuid
There are important files that Microsoft projects should all have that are not present in this repository. A pull request has been opened to add the missing file(s). When the pr is merged this issue will be closed automatically.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.
Maybe this is not how the library is intended to be used. If that is the case, then please close.
var uuidValidate = require("uuid-validate")
// Behaves as expected
uuidValidate('b38d63b5-524f-468c-b1c8-942c8c2284325') // => false
uuidValidate.version('b38d63b5-524f-468c-b1c8-942c8c2284325') // => 4
Would it make sense to have version()
also return false
if the UUID is invalid?
import validate from "uuid-validate";
....
....
const id = 'b8283d-7b7d-4e32-b3ce-81844e2b3c83';
console.log(validate(id));
throwing error: Uncaught ReferenceError: Buffer is not defined
> var validate = require('uuid-validate');
> var uuid = require('node-uuid');
> var u = uuid.v4()
> validate(u)
false
> u
'97a90793-4898-4abe-b255-e8dc6967ed40'
> validate(u,4)
false
> validate(u,1)
true
> validate.version(u)
4
As you can see, it validates as version 1, but validate.version() returns version 4. Something isn't right.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.