Alphabet Module
Contains utilities for working with alphabets.
Functions and values
| Function or value |
Description
|
||
|
Creates a new NanoId instance of the given size whose letters are taken from the given alphabet.
|
||
|
Builds a new Alphabet from the given letter set after checking that it upholds certain invariants which are necessary for the algorithm to work well. An alphabet's letters MUST uphold the following invariants:
|
||
Full Usage:
Alphabet.ofLetters letters
Parameters:
string
-
The letter set which will ultimately be used to generate
NanoId instances.
Returns: Result<Alphabet, InvalidAlphabet>
On successful validation, returns a Alphabet;
otherwise, returns a InvalidAlphabet
with further details about what went wrong.
|
Builds a new Alphabet from the given letter set after checking that it upholds certain invariants which are necessary for the algorithm to work well. An alphabet's letters MUST uphold the following invariants:
|
||
|
Attempts to convert the given
If the given value is empty (ie:
|
||
|
Attempts to convert the given
Parsing will "fail" (ie: return
|
ananoid