Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUID port for go doc added #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akshayvadher
Copy link

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:

  • Instead of ^[0-9a-z]+$, the test CUID function checks for ^[a-z][0-9a-z]+$ for more accurate result
  • For histogram test, instead of dropping the first two chars (.slice(2)), I am dropping only the first for more accurate testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant