All files check.option.js

75% Statements 21/28
77.77% Branches 14/18
100% Functions 1/1
76.92% Lines 20/26

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43  1x 1x 1x 1x 11x 11x 4x 4x             4x 4x 43x     11x             11x     11x     11x 2x   9x 2x   7x   1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkOptions = void 0;
var types_1 = require("./types");
var checkOptions = function (result, option) {
    var newResult = result;
    if (option.insertSymbol) {
        newResult = '';
        var characters = option.range
            ? option.range + types_1.symbols + option.range
            : option.charset === 'number'
                ? types_1.numberSymbol
                : option.charset === 'alphabet'
                    ? types_1.alphabetSymbol
                    : types_1.alphabetNumericSymbol;
        var charactersLength = characters.length;
        for (var i = 0; i < option.length; i++) {
            newResult += characters.charAt(Math.floor(Math.random() * charactersLength));
        }
    }
    Iif (option.symbolsOnly) {
        newResult = '';
        var charactersLength = types_1.symbols.length;
        for (var i = 0; i < option.length; i += 1) {
            newResult += types_1.symbols.charAt(Math.floor(Math.random() * charactersLength));
        }
    }
    Iif (option.prefix) {
        newResult = option.prefix + newResult;
    }
    Iif (option.suffix) {
        newResult = newResult + option.suffix;
    }
    if (option.lowerCaseOnly) {
        return newResult.toLowerCase();
    }
    if (option.upperCaseOnly) {
        return newResult.toUpperCase();
    }
    return newResult;
};
exports.checkOptions = checkOptions;