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

random-char

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-char

Return a random character.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

random-char

Return a random character.

MIT License

build:? coverage:?

Install

$ npm install --save random-char 

Usage

For more use-cases see the tests

var randomChar = require('random-char');

// API
// - randomChar([poolName]);
// - randomChar([options]);

randomChar();
// => 'k'

By default it will return a string with random character from the following pool:

'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&()*_+-={}[]'

Optionally specify a pool:

randomChar('alpha'); // or
randomChar({alpha: true});
// => 'm'

randomChar('upper'); // or
randomChar({upper: true});
// => 'Z'

randomChar('lower'); // or
randomChar({lower: true});
// => 'j'

randomChar('number'); // or
randomChar({number: true});
// => '7'

randomChar('symbols'); // or
randomChar({symbols: true});
// => '%'

Optionally specify a pool and the character will be generated with characters only from that pool:

randomChar('abcde'); // or
randomChar({pool: 'abcde'});
// => 'c'

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

Keywords

FAQs

Package last updated on 25 Apr 2016

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