@dizmo/functions-random
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

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

Package Sidebar

Install

npm i @dizmo/functions-random

Weekly Downloads

0

Version

2.0.7

License

ISC

Unpacked Size

315 kB

Total Files

16

Last publish

Collaborators

  • dizmo-user
  • hsk81