aprog 1.8.1 → 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.1",
3
+ "version": "1.8.3",
4
4
  "description": "Допоміжна бібліотека js",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/html.js CHANGED
@@ -10,7 +10,7 @@ export function pushHTMLElementPrototype() {
10
10
  export function pushAfterHTMLElementPrototype() {
11
11
  if (!HTMLElement.prototype.pushAfter) {
12
12
  HTMLElement.prototype.pushAfter = function (element, existingChild) {
13
- parent.insertBefore(element, existingChild.nextSibling);
13
+ this.insertBefore(element, existingChild.nextSibling);
14
14
  };
15
15
  }
16
16
  }
@@ -18,7 +18,19 @@ export function pushAfterHTMLElementPrototype() {
18
18
  export function pushBeforeHTMLElementPrototype() {
19
19
  if (!HTMLElement.prototype.pushBefore) {
20
20
  HTMLElement.prototype.pushBefore = function (element, existingChild) {
21
- parent.insertBefore(element, existingChild);
21
+ this.insertBefore(element, existingChild);
22
+ };
23
+ }
24
+ }
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
+ }
22
34
  };
23
35
  }
24
36
  }
@@ -26,3 +38,4 @@ export function pushBeforeHTMLElementPrototype() {
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
+ };