Predefined character sets to use with nanoid. Used by nanoid-generate.
A fork of CyberAP/nanoid-dictionary.
Install nanoid and dictionary
npm i @nichoth/nanoid @nichoth/nanoid-dictionary
Require a customAlphabet
from nanoid
and pass a string from the dictionary:
import { customAlphabet } from '@nichoth/nanoid';
import { lowercase } from '@nichoth/nanoid-dictionary';
const lowercaseRandomString = customAlphabet(lowercase, 10);
Numbers from 0 to 9
import { numbers } from '@nichoth/nanoid-dictionary';
Lowercase English hexadecimal lowercase characters: 0123456789abcdef
import { hexadecimalLowercase } from '@nichoth/nanoid-dictionary';
Lowercase English hexadecimal uppercase characters: 0123456789ABCDEF
import { hexadecimalUppercase } from '@nichoth/nanoid-dictionary';
Lowercase English letters: abcdefghijklmnopqrstuvwxyz
import { lowercase } from '@nichoth/nanoid-dictionary';
Uppercase English letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
import { uppercase } from '@nichoth/nanoid-dictionary';
Combination of all the lowercase, uppercase characters and numbers from 0 to 9
Does not include any symbols or special characters
import { alphanumeric } from '@nichoth/nanoid-dictionary';
Numbers and english alphabet without lookalikes: 1
, l
, I
, 0
, O
, o
, u
, v
, 5
, S
, s
, 2
, Z
.
Complete set: 346789ABCDEFGHJKLMNPQRTUVWXYabcdefghijkmnpqrtwxyz
import { nolookalikes } from '@nichoth/nanoid-dictionary';
Same as nolookalikes
but with removed vowels and following letters: 3
, 4
, x
, X
, V
.
This list should protect you from accidentally getting obscene words in generated strings.
Complete set: 6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz
import { nolookalikesSafe } from '@nichoth/nanoid-dictionary';