outers
Version:
outers - a all in one package for your day to day use
84 lines • 2.77 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const MixedGen_1 = __importDefault(require("../gen/MixedGen")); // function for generating a random word
// function for generating a random mixed ID
/**
* This TypeScript function generates a random mixed ID of a specified length, with the option to
* include custom characters and make the ID all capital letters.
* @param {num} [length=1] - The length parameter is a number that determines the length of the
* generated mixed ID.
* @param {bool} [isCAPITAL=false] - A boolean parameter that determines whether the generated mixed ID
* should be in all capital letters or not. If set to true, the function will return the generated ID
* in all capital letters. If set to false or not provided, the function will return the generated ID
* in lowercase letters.
* @param {str[]} [CustomMixeds] - CustomMixeds is an optional parameter that allows the user to
* provide their own array of characters to be used in generating the mixed ID. If this parameter is
* not provided, the function will use the default array of characters defined in the code.
* @returns a Promise that resolves to a string. The string is a randomly generated mixed ID of the
* specified length, with the option to include custom characters and to make the ID all uppercase.
*/
function GenerateMixedID(length = 1, isCAPITAL = false, CustomMixeds) {
/* This line of code is creating an array of all possible letters from 'a' to 'z' that will be used to*/
const Mixed = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
"!",
"@",
"#",
"$",
"%",
"^",
"&",
"*",
"(",
")",
"-",
"_",
"=",
"+",
"[",
"]",
"{",
"}",
";",
":",
"<",
".",
">",
"/",
"?",
"|",
"\\",
"~",
]; // All Possible Words to generate
let Result = (0, MixedGen_1.default)(length, CustomMixeds !== undefined ? CustomMixeds : Mixed); // Generate the Random Number
// Checking if the Word should be Capital
if (isCAPITAL === true) {
return (Result = Result.toUpperCase()); // Return the Result in Capital
}
else {
return Result; // Return the Result
}
}
exports.default = GenerateMixedID;
//# sourceMappingURL=MixedFunction.js.map