Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-random-string

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-random-string

To create random string

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-random-string

To create a random string.

Installation

To install node-random-string, use npm:

npm i node-random-string -S

Usage

import randomString from 'node-random-string';

randomString();
/* '1Uobd2CVV2mXwc7F7yKCvLRVgUBDH3DB' */

randomString(12);
/* 'uU4u1QyytM4U' */

randomString({
  length: 12,
  charset: 'alphabetic'
});
/* 'nORLfqUfkuxn' */

randomstring({
  chars: 'abc'
});
/* 'bbcaaccbacccccbabacacbacabbcbccb' */

randomString({
  length: 12,
  upperCase: true
});
/* 'FQVI8YMT1D81' */

Options

  • length - define the length of the string. (default: 32) [OPTIONAL]
  • charset - define the character set for the string. (default: [0-9 a-z A-Z]) [OPTIONAL]
    • alphabetic - [a-z A-Z]
    • numeric - [0-9]
  • chars - define the characters of the string. (default: null) [OPTIONAL]
  • lowerCase - define whether the output should be lowercase only. (default: null) [OPTIONAL]
  • upperCase - define whether the output should be uppercase only. (default: null) [OPTIONAL]

Tests

npm install
npm test

Keywords

FAQs

Package last updated on 18 Apr 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc