koalacodes
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Koala Codes

Random Codes Generator

THIS LIBRARY IS IN EARLY STAGES - EXPECT BEAKING CHANGES


Description:

This library generates random codes alternating consonants and vowels.


Installation:

npm install koalacodes

Usage:

const KoalaCodes = require("koalacodes");

const KC = new KoalaCodes();

console.log(KC.generateCode(-1)); // Defaults to 8 - YIFEJUMA
console.log(KC.generateCode(0));  // Defaults to 8 - HOVUDETO
console.log(KC.generateCode());   // Defaults to 8 - MUWAXIDE
console.log(KC.generateCode(1));  // H
console.log(KC.generateCode(4));  // SANA
console.log(KC.generateCode(7));  // HOKUDET
console.log(KC.generateCode(12)); // NOWUKUZEDEWI

Set a default length by passing an object with defaultLength on it. (More options to come in future versions)

const KC = new KoalaCodes({ defaultLength: 6 });

Using import syntax:

import KoalaCodes from "koalacodes";

User defined arrays of vowels and consonants

const KC = new KoalaCodes({
	defaultLength: 7,
	vowels: ["а", "е", "ё", "и", "о", "у", "ы", "э", "ю", "я"],
	consonants: ["б", "в", "г", "д", "ж", "з", "к", "л", "м", "н", "п", "р", "с", "т", "ф", "х", "ц", "ч", "ш", "щ"]
});

console.log(KC.generateCode(4));  // хажя
console.log(KC.generateCode());   // рулакыч

Notes

At this stage the library will always generate a code that alternates consonants with vowels starting always with a consonant. This is just a way to make the codes somewhat readables.


TODO and Future Features

  • User defined starting letter (vowel/consonant)
  • Hability to control UpperCase and LowerCase letters

Feedback

All feedback is welcome just write an issue.


License MIT

Package Sidebar

Install

npm i koalacodes

Weekly Downloads

2

Version

0.0.5

License

MIT

Unpacked Size

6.21 kB

Total Files

4

Last publish

Collaborators

  • mramericanmike