diff --git a/src/lang/en.js b/src/lang/en.js index c93075d..5a3bf70 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -1,16 +1,5 @@ -const compile = require("pug").compile const data = {...require("./base")} - -/** - * @param {string} text - */ -function pug(text) { - let lines = text.split("\n") - while (lines[0] === "") lines.shift() - const indentLevel = lines[0].match(/^\t*/)[0].length - lines = lines.map(l => l.replace(new RegExp(`^\\t{0,${indentLevel}}`), "")) - return compile(lines.join("\n")) -} +const {pug} = require("./utils/functions") ;(() => { data.go_to_profile = "Go to profile" diff --git a/src/lang/utils/functions.js b/src/lang/utils/functions.js new file mode 100644 index 0000000..56376cd --- /dev/null +++ b/src/lang/utils/functions.js @@ -0,0 +1,14 @@ +const compile = require("pug").compile + +/** + * @param {string} text + */ +function pug(text) { + let lines = text.split("\n") + while (lines[0] === "") lines.shift() + const indentLevel = lines[0].match(/^\t*/)[0].length + lines = lines.map(l => l.replace(new RegExp(`^\\t{0,${indentLevel}}`), "")) + return compile(lines.join("\n")) +} + +module.exports.pug = pug