@dizmo/functions-random

random strings

Stats

StarsIssuesVersionUpdatedCreatedSize
@dizmo/functions-random
002.0.64 months ago3 years agoMinified + gzip package size for @dizmo/functions-random in KB

Readme

NPM version Build Status Coverage Status

@dizmo/functions-random

Attaches to the String type a random function which returns a random string for the provided number of bytes and encoding with ascii, base64, hex, latin1 and ucs2 as possible values. By default the number of bytes is 16 and the default encoding is hex.

Usage

Install

npm install @dizmo/functions-random --save

Require

const { random } = require('@dizmo/functions-random');

Examples

random(16);
2fa6651ce3680dd13899156f9550ec61
random(16, 'hex');
d00e24ae8348004bca2f9c07ba6ae43b
random(16, 'ascii');
lZq\x01\x07j\x17:OnlG9u[\x13
random(16, 'base64');
QbqxfgF3JBiCktUQl+p9lQ==
random(16, 'latin1');
ؼ\x8D\x9F*>\nØ\x83BÃÑë{\x15Ð
random(16, 'ucs2');
☔戠䰍⧗灺밄䯗晡

Development

Clean

npm run clean

Build

npm run build

without linting and cleaning:

npm run -- build --no-lint --no-clean

with UMD bundling (incl. minimization):

npm run -- build --prepack

with UMD bundling (excl. minimization):

npm run -- build --prepack --no-minify

Lint

npm run lint

with auto-fixing:

npm run -- lint --fix

Test

npm run test

without linting, cleaning and (re-)building:

npm run -- test --no-lint --no-clean --no-build

Cover

npm run cover

without linting, cleaning and (re-)building:

npm run -- cover --no-lint --no-clean --no-build

Documentation

npm run docs

Publish

npm publish

initially (if public):

npm publish --access=public

Copyright

© 2020 dizmo AG, Switzerland

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.