Gathering detailed insights and metrics for callsign-uid
Gathering detailed insights and metrics for callsign-uid
Gathering detailed insights and metrics for callsign-uid
Gathering detailed insights and metrics for callsign-uid
A NodeJS package that generates easily memorizable unqiue ids.
npm install callsign-uid
Typescript
Module System
Node Version
NPM Version
68.3
Supply Chain
86
Quality
75.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
916
Last Day
1
Last Week
1
Last Month
12
Last Year
145
1 Stars
13 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.6
Package Id
callsign-uid@1.0.6
Unpacked Size
7.02 kB
Size
2.88 kB
File Count
5
NPM Version
9.2.0
Node Version
18.12.1
Publised On
26 Oct 2023
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-88.9%
1
Compared to previous week
Last month
20%
12
Compared to previous month
Last year
-81.2%
145
Compared to previous year
No dependencies detected.
A NodeJS package that generates easily memorizable unqiue ids.
To create a random CUID:
1const Cuid = require("callsign-uid"); 2var myCuid = Cuid.Random(); 3var text = myCuild.text;
To convert from Denary to CUID:
1const Cuid = require("callsign-uid"); 2const myNum = 415898986; 3var myCuid = Cuid.FromDenary(myNum); 4console.log(myCuid.text); //ALJET959L (lower case)
CUID generates a uid has the format of [Pronounceable 5-letter word][3 digits][1 single letter]
. Combined, this algorithm yields 25,000,000,000 (25 billion) unique ids for a single CUID. Multiple CUIDs can be combined to yield more unique ids.
We will focus on the generation of the pronounceable 5-letter word. The 3 digits and 1 letter are simple randomly chosen from a character set. In the following explanation, the letter V
will be used to represent a Vowel, and the letter C
will represent a Consonant. The letter Y
does not count as a vowel, nor a consonant. It is only used for special purposes..
Suppose a 5-letter phrase, 12345
, where each number represents the corresponding character in a pronounceable 5-letter word, the rules are:
12
must be either VC
or CV
.345
must be exactly CVC
.2
is a consonant, then 3
cannot be the same as 2
. If 3
is the sames as 2
when randomly generated, 3
will use the character Y
.This is guaranteed to produce a pronounceable word. For example:
AVBOX
DAHOT
TURET
A full CUID could look like:
AVBOX681D
DAHOT039A
TURET223Q
QULEM001D
Note that 0
s is padded to the front of the three-digit number.
Sometimes there may be the need to convert a number into a CUID. Heres how it works:
Counting in CUID works the same way as denary numbers. You count up from the rightmost number, and when that number reaches the limit, your increment the number to the left of it by 1. With CUID, it is the same. You start from the rightmost. Note that there are no capitalization. Assume all characters are upper or lower case.
Some rules regarding counting:
0
is the lowest data level, 9
is the highest data level.A
is the lowest data level, U
is the highest.B
is the lowest data level, Z
is the highest.According to these rules, the denary number 0
would translate to ABCAB000A
in CUID. The denary number 1
would translate to ABCAB000B
.
It is important to know that an algorithm that generates a pronounceable word is prone to generating innapropriate or vulgar words. While there is an filter for vulgar words, it is not fool-proof.
No vulnerabilities found.
No security vulnerabilities found.