Socket
Socket
Sign inDemoInstall

nanoid-dictionary

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nanoid-dictionary

Predefined character sets to use with nanoid


Version published
Maintainers
1
Install size
6.15 kB
Created

Changelog

Source

4.3.0

  • Updated Readme to include updated instructions (thanks @kyle-chine-leismore), added sets preview
  • Updated examples to use ES imports, removed examples for direct file imports ( nanoid-dictionary/lowercase.js, etc.)
  • Added typings
  • Simplified index.js

Readme

Source

nanoid-dictionary

Predefined character sets to use with nanoid. Used by nanoid-generate.

npm

Usage

Install nanoid and dictionary

npm i nanoid nanoid-dictionary

Require a customAlphabet from nanoid and pass a string from the dictionary:

import { customAlphabet } from 'nanoid';
import { lowercase } from 'nanoid-dictionary';

const lowercaseRandomString = customAlphabet(lowercase, 10);

Character sets

numbers

Numbers from 0 to 9

import { numbers } from 'nanoid-dictionary';

lowercase

Lowercase English letters: abcdefghijklmnopqrstuvwxyz

import { lowercase } from 'nanoid-dictionary';

uppercase

Uppercase English letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ

import { uppercase } from 'nanoid-dictionary';

alphanumeric

Combination of all the lowercase, uppercase characters and numbers from 0 to 9

Does not include any symbols or special characters

import { alphanumeric } from 'nanoid-dictionary';

nolookalikes

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 'nanoid-dictionary';

nolookalikesSafe

Same as noolookalikes 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 'nanoid-dictionary';

FAQs

Last updated on 07 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc