Support nil or empty uuid
See original GitHub issueIs your feature request related to a problem? Please describe.
I wanted to go ahead and make a PR for adding nil uuid which is a special case. Before doing the work, I just wanted to double check to see if this has been considered before or there are any objections to it.
You can read more about nil uuid https://en.wikipedia.org/wiki/Universally_unique_identifier#Nil_UUID
Describe the solution you’d like
I was thinking about adding nill to the namespace so the user can write the following code:
import { nil } from 'uuid';
console.log(nil()); // => '00000000-0000-0000-0000-000000000000'
I believe that is valid for all versions, so we dont need to implement it under v1, v2, etc. Let me know your thoughts and I’ll get to it.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Instance of an empty ("nil") UUID in Java - Stack Overflow
Constructor. Use the constructor taking a pair of long integers, both zero. java.util.UUID uuid = new UUID( 0 , 0 ); // Or...
Read more >UUID always nil | Apple Developer Forums
Hi,. In my Mac OS app I'm trying to create an UUID from a string. the code is taken straight from the documentation...
Read more >Your Nil/Empty UUID - Online UUID Generator
Quickly and easily generate individual or bulk sets of universally unique identifiers (UUIDs).
Read more >UUID 'null' becomes '00000000-0000-0000 ... - Google Groups
Hello everybody, I found something that seems to be illogically to me. My database uses UUIDs as primary and foreign keys. The software...
Read more >"Not a valid UUID" on nil UUID - Help me!
Observed behavior The FA front end does not accept the nil UUID as a valid UUID ... For you to know, you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t have any opinions on this feature but just saw the issue and wanted to share a nil uuid use case from: https://developer.apple.com/documentation/adsupport/asidentifiermanager/1614151-advertisingidentifier
So, there are a lot of client’s which do conditional logic on the backend to handle it. Why Apple does this perplexes me but they do.
Yes, I was able to make the following work