Add Option to Retain UUID Format Instead of Base64 Encoding
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 752
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
Hyperid’s principle is indeed great, using a UUID + counter avoids unnecessary UUID generations while keeping it sequential within a single instance. However, Hyperid doesn’t support retaining the original UUID format. It currently encodes the UUID into Base64, making it more compact but harder to read and manipulate. It would be beneficial to have an option to retain the UUID in its original format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) while still appending the counter as usual.
Use Case & Benefits
- Improved Readability: The standard UUID format is widely recognized, making logs/debugging easier.
- Easier Integration: Many systems expect UUIDs in their native format rather than Base64.
- No Performance Hit: Avoids the extra encoding/decoding step while keeping Hyperid’s efficiency.
Proposed Solution
Introduce an option to disable Base64 encoding, allowing users to get the UUID in its standard format. Example API:
const hyperid = require('hyperid')({ format: 'uuid' }); // Default could remain 'base64'
console.log(hyperid()); // Outputs: "049b7020-c787-41bf-a1d2-a97612c11418-0"
console.log(hyperid()); // Outputs: "049b7020-c787-41bf-a1d2-a97612c11418-1"
Would love to hear your thoughts on this!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating hyperid’s option parsing and the current UUID/Base64 generation entry point in the JavaScript package. Review the existing generation tests, then verify that the new format option preserves the default behavior and produces standard UUIDs with the counter appended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100