1.0.2 • Published 3 years ago

randomix v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

node-randomix | Mert Arguc

Library to help you create random strings.

Installation

To install randomix, use npm:

npm install randomix

Usage

var randomix = require("randomix");

randomix.generate();
// >> "XwPp9xazJ0ku5CZnlmgAx2Dld8SHkAeT"

randomix.generate(7);
// >> "xqm5wXX"

randomix.generate({
  length: 12,
  charset: 'alphabetic'
});
// >> "AqoTIzKurxJi"

randomix.generate({
  charset: 'abc'
});
// >> "accbaabbbbcccbccccaacacbbcbbcbbc"

randomix.generate({
  charset: 'abc'
}, cb);
// >> "cb(generatedString) {}"

API

randomix.

  • generate(options, cb)
    • options
      • length - the length of the random string. (default: 32) OPTIONAL
      • readable - exclude poorly readable chars: 0OIl. (default: false) OPTIONAL
      • charset - define the character set for the string. (default: 'alphanumeric') OPTIONAL
      • capitalization - define whether the output should be lowercase / uppercase only. (default: null) OPTIONAL
        • lowercase
        • uppercase
    • cb - Optional. If provided uses async version of crypto.randombytes

Command Line Usage

$ npm install -g randomix

$ randomix
> sKCx49VgtHZ59bJOTLcU0Gr06ogUnDJi

$ randomix 7
> CpMg433

$ randomix length=24 charset=github readable
> hthbtgiguihgbuttuutubugg

Tests

npm install
npm test

LICENSE

node-randomix is licensed under the MIT license.