rse / pure-uuid

Pure JavaScript Based Universally Unique Identifiers (UUID)
https://www.npmjs.com/package/pure-uuid
66 stars 16 forks source link

Namespace check is too strict? #10

Closed noherczeg closed 7 years ago

noherczeg commented 7 years ago

The new UUID().parse(arguments[1]) phase only accepts your pre-defined few types. This is not documented if I'm not mistaken. Why has this logic been added since 1.1.x?

This UUID(3, "whatever", "value") used to work, now it fails.

rse commented 7 years ago

Well, what should happen for the namespace "whatever"? Unfortunately, it is not a valid UUID. That it worked in 1.1.x is just because JavaScript did not bail out with an error, although internally an incorrect conversion was done. Please change your new UUID(3, "whatever", "value") to e.g. `new UUID(3, new UUID(3, "ns:URL", "info:hdl/example.com/whatever"), "value") if you want to be compliant to the UUID standards and make it working with PureUUID again.