aprog 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/index.js +9 -0
- package/index.test.js +7 -0
- package/package.json +27 -0
- package/src/aprog.js +1306 -0
- package/src/debugger.js +30 -0
- package/src/redirect.js +9 -0
- package/src/shifrator.js +23 -0
package/src/debugger.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class Debugger {
|
|
2
|
+
#consoleDump = (args) => {
|
|
3
|
+
args.forEach(arg => {
|
|
4
|
+
const type = typeof arg;
|
|
5
|
+
if (type === 'object') {
|
|
6
|
+
console.info(arg);
|
|
7
|
+
} else {
|
|
8
|
+
console.warn(`(%c${type}%c): %c${arg}`, 'color: #ff5722;', 'color: #007acc;', 'color: #333;');
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
dump = (...args) => {
|
|
14
|
+
console.group('%c🛠️ Dump Output:', 'font-weight: bold; color: #043458; font-size: 12px; background-color: #b3c2cc; padding: 4px 16px; border-radius: 4px;');
|
|
15
|
+
console.warn('%cLocation:', 'color: #000acc; font-style: italic; font-size: 10px; background-color: #b3c2cc; padding: 4px 8px; border-radius: 4px;');
|
|
16
|
+
this.#consoleDump(args);
|
|
17
|
+
console.groupEnd();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
dd = (...args) => {
|
|
21
|
+
console.group('%c🛠️ Debug Dump Output', 'font-weight: bold; color: #043458; font-size: 12px; background-color: #b3c2cc; padding: 4px 16px; border-radius: 4px;');
|
|
22
|
+
this.#consoleDump(args);
|
|
23
|
+
console.groupEnd();
|
|
24
|
+
debugger;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const debuggerClass = new Debugger();
|
|
29
|
+
export const dump = (...args) => debuggerClass.dump(args);
|
|
30
|
+
export const dd = (...args) => debuggerClass.dd(args);
|
package/src/redirect.js
ADDED
package/src/shifrator.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class Shifrator {
|
|
2
|
+
constructor(key = 3) {
|
|
3
|
+
this.key = key;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
encrypt(str) {
|
|
7
|
+
return str
|
|
8
|
+
.split('')
|
|
9
|
+
.map(char => String.fromCharCode(char.charCodeAt(0) + this.key))
|
|
10
|
+
.join('');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
decrypt(encryptedStr) {
|
|
14
|
+
return encryptedStr
|
|
15
|
+
.split('')
|
|
16
|
+
.map(char => String.fromCharCode(char.charCodeAt(0) - this.key))
|
|
17
|
+
.join('');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const shifratorClass = new Shifrator();
|
|
22
|
+
export const encrypt = (str) => shifratorClass.encrypt(str);
|
|
23
|
+
export const decrypt = (encryptedStr) => shifratorClass.decrypt(encryptedStr);
|