JSFiddle - React, Tailwind, and code Playground

JavaScript

// @dict_type - Массив словарей (по умолчанию - латиница)
// Все элементы массива должны быть строкового типа
// В качестве элементов массива могут быть переданы следующие значения:
//    а) Ссылка на один [или несколько] из встроенных словарей
//       Доступны: 'latin', 'cyrillic', 'digits'
//    б) пользовательский словарь (набор [или наборы] любых символов)    
// @length - Длина генерируемой строки (по умолчанию 5 символов)    
// @sensetive - В обоих регистрах? (true | false, по умолчанию - false);
// Функция возвращает сгенерированную строку или false в случае неудачи

function generateSeed(dict_type, length, sensetive) {
    dict_type = typeof dict_type !== 'undefined' ? dict_type : ['latin'];
    length = typeof length !== 'undefined' ? length : 5;
    sensetive = typeof sensetive !== 'undefined' ? !! sensetive : false;
    if (checkArray(dict_type) && typeof length === 'number') {
        var text = "",
            dict = "",
            def = "",
            custom = "",
            possible = [];
        possible.latin = "abcdefghijklmnopqrstuvwxyz";
        possible.cyrillic = "абвгдеёжзийклмнопрстуфхцчъыьэюя";
        possible.digits = "0123456789";
        for (j = 0; j < (dict_type.length); ++j) {
            def = possible[dict_type[j]];
            custom = dict_type[j];
            if (typeof def !== 'undefined') {
                dict += (sensetive) ? def + def.toUpperCase() : def;
            } else {
                dict += (sensetive) ? custom + custom.toUpperCase() : custom;
            }
        }
        for (i = 0; i < length; ++i) {
            text += dict.charAt(Math.floor(Math.random() * dict.length));
        }
        return (text === "") ? false : text;
    } else {
        return false;
    }
}

//Вспомогательная функция для проверки входного словаря
function checkArray(input) {
    if (input instanceof Array) {
        for (i = 0; i < input.length; ++i) {
            if (typeof input[i] !== 'string') {
                return...