UNPKG

sectom

Version:

Sectom is a useful npm package that has multiple easy to use functions.

629 lines (551 loc) 17.5 kB
/** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`**${output}**`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`**${input}**`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const underline = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`__${output}__`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`__${input}__`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const italic = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`*${output}*`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`*${input}*`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~${output}~~`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~${input}~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const center = (input) => { const center = "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀"; if (typeof input === "string") { var outcome = []; outcome.push(`${center}${input}`); return outcome.toString(); } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const subCenter = (input) => { const center = "⠀⠀⠀⠀⠀⠀⠀⠀ "; if (typeof input === "string") { var outcome = []; outcome.push(`${center}${input}`); return outcome.toString(); } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~**${output}**~~`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~**${input}**~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const italic_crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~*${output}*~~`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~*${input}*~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_italic_crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~***${output}***~~`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~***${input}***~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const underline_crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~__${output}__~~`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~__${input}__~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_underline_crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~**__${output}__**~~`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~**__${input}__**~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_italic_underline_crossout = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`~~***__${output}__***~~`); }); return outcome.toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`~~***__${input}__***~~`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_underline = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`__**${output}**__`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`__**${input}**__`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_italic = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`***${output}***`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`***${input}***`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const bold_italic_underline = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`__***${output}***__`); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`__***${input}***__`); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`${output}\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`${input}\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_multiline = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`\n${output}\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`\n${input}\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_red = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`diff\n- ${output}\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`diff\n-${input}\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_yellow = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`fix\n${output}\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`fix\n${input}\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_dark_yellow = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`apache\n${output}\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`apache\n${input}\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_green = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`diff\n+${output}\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`diff\n+${input}\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_light_green = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`css\n"${output}"\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`css\n"${input}"\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_dark_green = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`bash\n"${output}"\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`bash\n"${input}"\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_blue = (input) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { outcome.push(`\`\`\`ini\n[${output}]\n\`\`\``); }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`ini\n[${input}]\n\`\`\``); return outcome.toString(); } else { return input; } }; /** * @description A function part of the formatter file often used to format certain things easily using a string or an Array of strings * @param {(string| string[])} input - The input for the function * @returns {string} A string */ const code_block_color_logger = (input, boolean) => { var outcome; if (Array.isArray(input)) { var outcome = []; input.forEach((output) => { if ( outcome.length >= 1 && (typeof boolean === "boolean" || ((boolean === "true" || boolean === "false") && (boolean === true || boolean === "true"))) ) { outcome.push(`\`\`\`ELM\n${output}\n\`\`\``); } else { outcome.push(`\`\`\`ELM\n${output}\n\`\`\``); } }); return outcome.join("").toString(); } else if (typeof input === "string") { var outcome = []; outcome.push(`\`\`\`ELM\n${input}\n\`\`\``); return outcome.toString(); } else { return input; } }; module.exports = { formatter: { defaults: { bold, underline, italic, bold_italic, bold_underline, bold_italic_underline, }, crossouts: { crossout, italic_crossout, bold_crossout, bold_italic_crossout, underline_crossout, bold_underline_crossout, bold_italic_underline_crossout, }, code_blocks: { code_block, blue: code_block_color_blue, green: code_block_color_green, dark_green: code_block_color_dark_green, light_green: code_block_color_light_green, red: code_block_color_red, yellow: code_block_color_yellow, dark_yellow: code_block_color_dark_yellow, multiline: code_block_multiline, logger: code_block_color_logger, }, }, };