aprog 1.8.2 → 1.8.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/index.js CHANGED
@@ -6,7 +6,7 @@ export {
6
6
  firstKey, isArray, checkArrays, isNumber, isString, isPromise, ucfirst, deepEqual, nodeListToObject
7
7
  } from './src/aprog.js';
8
8
  export { dump, dd } from './src/debugger.js';
9
- export { redirect, reload, validateEmail, validatePassword } from './src/redirect.js';
9
+ export { redirect, reload, validateEmail, validatePassword, delay } from './src/redirect.js';
10
10
  export { router, navigateTo, navi } from './src/router.js';
11
11
  export { encrypt, decrypt } from './src/shifrator.js';
12
12
  export { gemini } from './src/OpenAI.js';
@@ -14,4 +14,4 @@ export { mathInput, autoPPI } from './src/math.js';
14
14
  export { cookie, storage } from './src/storage.js';
15
15
  export { paginate, parseData } from './src/paginate.js';
16
16
  export { saveItem, loadItem, setSecretKey } from './src/secretStorage.js';
17
- export { pushHTMLElementPrototype, pushAfterHTMLElementPrototype, pushBeforeHTMLElementPrototype } from './src/html.js';
17
+ export { pushHTMLElementPrototype, pushAfterHTMLElementPrototype, pushBeforeHTMLElementPrototype, dataHTMLElementPrototype } from './src/html.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aprog",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "Допоміжна бібліотека js",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/html.js CHANGED
@@ -23,6 +23,19 @@ export function pushBeforeHTMLElementPrototype() {
23
23
  }
24
24
  }
25
25
 
26
+ export function dataHTMLElementPrototype() {
27
+ if (!HTMLElement.prototype.data) {
28
+ HTMLElement.prototype.data = function (name, value = undefined) {
29
+ if (value === undefined) {
30
+ return this.getAttribute(`data-${name}`);
31
+ } else {
32
+ this.setAttribute(`data-${name}`, value);
33
+ }
34
+ };
35
+ }
36
+ }
37
+
26
38
  pushHTMLElementPrototype();
27
39
  pushAfterHTMLElementPrototype();
28
40
  pushBeforeHTMLElementPrototype();
41
+ dataHTMLElementPrototype();
package/src/redirect.js CHANGED
@@ -24,3 +24,8 @@ export const validateEmail = (email) => {
24
24
  export const validatePassword = (password) => {
25
25
  return /^(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$/.test(password);
26
26
  };
27
+
28
+ export const delay = (handler, seconds, args = []) => {
29
+ seconds *= 10000;
30
+ setTimeout(handler, seconds, ...args)
31
+ };