Open OSA413 opened 3 months ago
The fix turned out to be easy, I actually think that it was a bug because it actually needed to be 16, not 0:
https://github.com/danakt/uuid-by-string/blob/master/src/index.js#L4
Anyway, here's the PR: https://github.com/danakt/uuid-by-string/pull/36
I've just found out that the generation of UUIDs without a namespace are not standard, all other implementations found online and in other programming languages requires providing a namespace and a name.
The specification explicitly says to use a namespace during generation:
Currently your library concatenates an empty array that results in using just the data of the provided name for hashing without any data of the namespace: https://github.com/danakt/uuid-by-string/blob/master/src/index.js#L35
Should you specify in the documentation about library's non-standard function?
Another solution would be using a nil UUID as namespace in cases when user provides no namespace (but that will break current tests that check the generation of UUID without a namespace).