Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since the readme didn't have a Go port, I only discovered two ports had already been created for Go when I came to PR. My bad.
Anyway, I created one at https://github.com/akshayvadher/cuid2
I have added all the histograms, char frequencies, and collision tests.
I made the syntax and structure as similar as possible so that reviewers could review it easily and make future changes easier.
Instead of removing the first char from the hash, I returned it as it was; the collision and histogram tests were failing (to test out that IDs are correctly generated and tests are correctly testing).
The entropy generator uses global variables (ENV variable keys).
Changes:
^[0-9a-z]+$
, the test CUID function checks for^[a-z][0-9a-z]+$
for more accurate result.slice(2)
), I am dropping only the first for more accurate testing