UNPKG

1.03 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const static_1 = require("./static");
4function obfuscate(text) {
5 const obfuscated = [];
6 text.split("").map(char => {
7 if (static_1.CharSizes.WIDE.indexOf(char) > -1)
8 return obfuscated.push(static_1.CharSizes.WIDE[Math.floor(Math.random() * static_1.CharSizes.WIDE.length)]);
9 if (static_1.CharSizes.MID.indexOf(char) > -1)
10 return obfuscated.push(static_1.CharSizes.MID[Math.floor(Math.random() * static_1.CharSizes.MID.length)]);
11 if (static_1.CharSizes.THIN.indexOf(char) > -1)
12 return obfuscated.push(static_1.CharSizes.THIN[Math.floor(Math.random() * static_1.CharSizes.THIN.length)]);
13 obfuscated.push(char);
14 });
15 return obfuscated.join("");
16}
17exports.default = obfuscate;
18(function () {
19 if (typeof window === "undefined")
20 return console.warn("Not running in the browser. Obfuscated text will not be re-obfuscated.");
21}());
22//# sourceMappingURL=obfuscate.js.map
\No newline at end of file