aprog 1.3.1 → 1.3.3
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 +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/math.js +6 -12
- package/src/redirect.js +3 -1
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ onInput: (event) => {
|
|
|
144
144
|
Загальний список методів:
|
|
145
145
|
|
|
146
146
|
- *dump(...args), dd(...args)*
|
|
147
|
-
- *redirect(url, { newTab: bool, replace: bool })*
|
|
147
|
+
- *redirect(url, { newTab: bool, replace: bool }), reload(delaySeconds)*
|
|
148
148
|
- *encrypt(str), decrypt(encryptedStr)*
|
|
149
149
|
|
|
150
150
|
- *div, span, button, a, img, meta, label, input, select, option, options, form, hr, textarea, table, thead, tbody, tr, th, td, pre*
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export {
|
|
|
5
5
|
firstKey, isArray, checkArrays, isNumber, isString, isPromise, ucfirst, deepEqual, nodeListToObject
|
|
6
6
|
} from './src/aprog.js';
|
|
7
7
|
export { dump, dd } from './src/debugger.js';
|
|
8
|
-
export { redirect } from './src/redirect.js';
|
|
8
|
+
export { redirect, reload } from './src/redirect.js';
|
|
9
9
|
export { router, navigateTo } from './src/router.js';
|
|
10
10
|
export { encrypt, decrypt } from './src/shifrator.js';
|
|
11
11
|
export { gemini } from './src/OpenAI.js';
|
package/package.json
CHANGED
package/src/math.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
export const mathInput = (target) => {
|
|
2
2
|
const enter = target.value.includes("=");
|
|
3
3
|
let result = target.value;
|
|
4
|
-
if (enter) {
|
|
5
|
-
const parts = target.value.slice(0, -1).split(/([\+\-\*\/])/);
|
|
6
|
-
|
|
7
|
-
const num1 = Number(parts[0]);
|
|
8
|
-
const operator = parts[1];
|
|
9
|
-
const num2 = Number(parts[2]);
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
if (enter) {
|
|
6
|
+
const expression = target.value.slice(0, -1);
|
|
7
|
+
try {
|
|
8
|
+
result = new Function(`return ${expression}`)();
|
|
9
|
+
} catch (error) {
|
|
10
|
+
result = target.value;
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
target.value = result;
|
package/src/redirect.js
CHANGED