diginext-utils 2.0.33 → 2.0.35

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.
Files changed (184) hide show
  1. package/package.json +1 -1
  2. package/src/console/index.ts +2 -2
  3. package/src/string/url.ts +2 -2
  4. package/dist/Checker.d.ts +0 -9
  5. package/dist/Checker.js +0 -52
  6. package/dist/Checker.mjs +0 -29
  7. package/dist/EventDispatcher.d.ts +0 -13
  8. package/dist/EventDispatcher.js +0 -77
  9. package/dist/EventDispatcher.mjs +0 -54
  10. package/dist/FileUpload.d.ts +0 -12
  11. package/dist/FileUpload.js +0 -85
  12. package/dist/FileUpload.mjs +0 -62
  13. package/dist/Slug.d.ts +0 -10
  14. package/dist/Slug.js +0 -354
  15. package/dist/Slug.mjs +0 -331
  16. package/dist/Timer-7b0c4e7c.d.ts +0 -11
  17. package/dist/Timer.d.ts +0 -1
  18. package/dist/Timer.js +0 -33
  19. package/dist/Timer.mjs +0 -7
  20. package/dist/Validation.d.ts +0 -6
  21. package/dist/Validation.js +0 -56
  22. package/dist/Validation.mjs +0 -35
  23. package/dist/array-dc599632.d.ts +0 -158
  24. package/dist/array.d.ts +0 -1
  25. package/dist/array.js +0 -277
  26. package/dist/array.mjs +0 -49
  27. package/dist/browser-8d042ffe.d.ts +0 -22
  28. package/dist/camera-1a859d72.d.ts +0 -15
  29. package/dist/chunk-5NTK5JAI.mjs +0 -57
  30. package/dist/chunk-5UEMANWE.mjs +0 -91
  31. package/dist/chunk-5ZOWNKSD.mjs +0 -166
  32. package/dist/chunk-6GNGTFNC.mjs +0 -118
  33. package/dist/chunk-7MK72U4O.mjs +0 -19
  34. package/dist/chunk-7XKT3AQX.mjs +0 -17
  35. package/dist/chunk-7ZCEZM7K.mjs +0 -41
  36. package/dist/chunk-AMBWJGSW.mjs +0 -151
  37. package/dist/chunk-C7S43KGB.mjs +0 -15
  38. package/dist/chunk-CJM7T7ON.mjs +0 -24
  39. package/dist/chunk-CKILLYAP.mjs +0 -16
  40. package/dist/chunk-DX7MUT3M.mjs +0 -51
  41. package/dist/chunk-EGUJQ5VF.mjs +0 -32
  42. package/dist/chunk-ETEIHDWU.mjs +0 -25
  43. package/dist/chunk-FJXSVGL7.mjs +0 -22
  44. package/dist/chunk-GJCAEOND.mjs +0 -20
  45. package/dist/chunk-GNJDIUYM.mjs +0 -40
  46. package/dist/chunk-IA7GINWD.mjs +0 -39
  47. package/dist/chunk-JEI7BOXY.mjs +0 -21
  48. package/dist/chunk-K4KENOE6.mjs +0 -20
  49. package/dist/chunk-KMERW6KS.mjs +0 -34
  50. package/dist/chunk-KPO3RH5G.mjs +0 -27
  51. package/dist/chunk-KWG5LYNK.mjs +0 -100
  52. package/dist/chunk-NUTQDHLQ.mjs +0 -40
  53. package/dist/chunk-O64XUDAH.mjs +0 -35
  54. package/dist/chunk-OYRPWQUA.mjs +0 -257
  55. package/dist/chunk-PNZ4KGXL.mjs +0 -56
  56. package/dist/chunk-QZYX26HT.mjs +0 -24
  57. package/dist/chunk-RDGP2CKM.mjs +0 -195
  58. package/dist/chunk-VFG5VU6S.mjs +0 -12
  59. package/dist/chunk-X3IMFCZG.mjs +0 -23
  60. package/dist/chunk-ZHNGZMRD.mjs +0 -17
  61. package/dist/color.d.ts +0 -24
  62. package/dist/color.js +0 -106
  63. package/dist/color.mjs +0 -78
  64. package/dist/console/enableConsole.d.ts +0 -1
  65. package/dist/console/enableConsole.js +0 -42
  66. package/dist/console/enableConsole.mjs +0 -9
  67. package/dist/console/index.d.ts +0 -2
  68. package/dist/console/index.js +0 -61
  69. package/dist/console/index.mjs +0 -14
  70. package/dist/console/log.d.ts +0 -16
  71. package/dist/console/log.js +0 -75
  72. package/dist/console/log.mjs +0 -19
  73. package/dist/createDir-220e0081.d.ts +0 -13
  74. package/dist/device/browser.d.ts +0 -1
  75. package/dist/device/browser.js +0 -66
  76. package/dist/device/browser.mjs +0 -15
  77. package/dist/device/camera.d.ts +0 -1
  78. package/dist/device/camera.js +0 -190
  79. package/dist/device/camera.mjs +0 -8
  80. package/dist/device/index.d.ts +0 -1
  81. package/dist/device/index.js +0 -210
  82. package/dist/device/index.mjs +0 -15
  83. package/dist/device/os.d.ts +0 -12
  84. package/dist/device/os.js +0 -65
  85. package/dist/device/os.mjs +0 -33
  86. package/dist/enableConsole-ddc24282.d.ts +0 -11
  87. package/dist/file/createDir.d.ts +0 -1
  88. package/dist/file/createDir.js +0 -37
  89. package/dist/file/createDir.mjs +0 -7
  90. package/dist/file/fileMove.d.ts +0 -1
  91. package/dist/file/fileMove.js +0 -53
  92. package/dist/file/fileMove.mjs +0 -7
  93. package/dist/file/findFilesByExt.d.ts +0 -1
  94. package/dist/file/findFilesByExt.js +0 -69
  95. package/dist/file/findFilesByExt.mjs +0 -11
  96. package/dist/file/index.d.ts +0 -11
  97. package/dist/file/index.js +0 -106
  98. package/dist/file/index.mjs +0 -17
  99. package/dist/fileMove-3a09e429.d.ts +0 -13
  100. package/dist/findFilesByExt-753e91d7.d.ts +0 -24
  101. package/dist/images/index.d.ts +0 -2
  102. package/dist/images/index.js +0 -132
  103. package/dist/images/index.mjs +0 -15
  104. package/dist/images/loadImage.d.ts +0 -3
  105. package/dist/images/loadImage.js +0 -42
  106. package/dist/images/loadImage.mjs +0 -21
  107. package/dist/images/resize.d.ts +0 -3
  108. package/dist/images/resize.js +0 -64
  109. package/dist/images/resize.mjs +0 -9
  110. package/dist/images/upload.d.ts +0 -11
  111. package/dist/images/upload.js +0 -132
  112. package/dist/images/upload.mjs +0 -14
  113. package/dist/index-1f738e52.d.ts +0 -22
  114. package/dist/index-22309f0c.d.ts +0 -23
  115. package/dist/index-6ae3c86b.d.ts +0 -63
  116. package/dist/index-c8fffc86.d.ts +0 -90
  117. package/dist/index-d652ed2c.d.ts +0 -26
  118. package/dist/index.d.ts +0 -48
  119. package/dist/index.js +0 -1353
  120. package/dist/index.mjs +0 -87
  121. package/dist/json.d.ts +0 -9
  122. package/dist/json.js +0 -52
  123. package/dist/json.mjs +0 -29
  124. package/dist/math/diffDate.d.ts +0 -6
  125. package/dist/math/diffDate.js +0 -36
  126. package/dist/math/diffDate.mjs +0 -9
  127. package/dist/math/index.d.ts +0 -3
  128. package/dist/math/index.js +0 -160
  129. package/dist/math/index.mjs +0 -34
  130. package/dist/math/positiveNumber.d.ts +0 -3
  131. package/dist/math/positiveNumber.js +0 -56
  132. package/dist/math/positiveNumber.mjs +0 -10
  133. package/dist/name/en.d.ts +0 -6
  134. package/dist/name/en.js +0 -44
  135. package/dist/name/en.mjs +0 -9
  136. package/dist/name/index.d.ts +0 -3
  137. package/dist/name/index.js +0 -88
  138. package/dist/name/index.mjs +0 -20
  139. package/dist/name/vi.d.ts +0 -6
  140. package/dist/name/vi.js +0 -66
  141. package/dist/name/vi.mjs +0 -14
  142. package/dist/object-43aaaf92.d.ts +0 -80
  143. package/dist/object.d.ts +0 -1
  144. package/dist/object.js +0 -105
  145. package/dist/object.mjs +0 -21
  146. package/dist/permission/index.d.ts +0 -9
  147. package/dist/permission/index.js +0 -231
  148. package/dist/permission/index.mjs +0 -15
  149. package/dist/permission/requestCamera.d.ts +0 -1
  150. package/dist/permission/requestCamera.js +0 -54
  151. package/dist/permission/requestCamera.mjs +0 -9
  152. package/dist/permission/requestDeviceOrientationControl.d.ts +0 -1
  153. package/dist/permission/requestDeviceOrientationControl.js +0 -206
  154. package/dist/permission/requestDeviceOrientationControl.mjs +0 -10
  155. package/dist/requestCamera-32b7dfc7.d.ts +0 -14
  156. package/dist/requestDeviceOrientationControl-b6458660.d.ts +0 -11
  157. package/dist/response/index.d.ts +0 -50
  158. package/dist/response/index.js +0 -97
  159. package/dist/response/index.mjs +0 -16
  160. package/dist/string/formatNumber.d.ts +0 -7
  161. package/dist/string/formatNumber.js +0 -56
  162. package/dist/string/formatNumber.mjs +0 -10
  163. package/dist/string/generatePassword.d.ts +0 -10
  164. package/dist/string/generatePassword.js +0 -55
  165. package/dist/string/generatePassword.mjs +0 -10
  166. package/dist/string/generateUUID.d.ts +0 -3
  167. package/dist/string/generateUUID.js +0 -40
  168. package/dist/string/generateUUID.mjs +0 -9
  169. package/dist/string/index.d.ts +0 -6
  170. package/dist/string/index.js +0 -316
  171. package/dist/string/index.mjs +0 -31
  172. package/dist/string/makeDaySlug.d.ts +0 -32
  173. package/dist/string/makeDaySlug.js +0 -47
  174. package/dist/string/makeDaySlug.mjs +0 -9
  175. package/dist/string/random.d.ts +0 -15
  176. package/dist/string/random.js +0 -56
  177. package/dist/string/random.mjs +0 -19
  178. package/dist/string/trimNull.d.ts +0 -3
  179. package/dist/string/trimNull.js +0 -49
  180. package/dist/string/trimNull.mjs +0 -9
  181. package/dist/string/url.d.ts +0 -1
  182. package/dist/string/url.js +0 -126
  183. package/dist/string/url.mjs +0 -22
  184. package/dist/url-60657387.d.ts +0 -57
package/dist/Timer.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/Timer.ts
21
- var Timer_exports = {};
22
- __export(Timer_exports, {
23
- default: () => Timer_default
24
- });
25
- module.exports = __toCommonJS(Timer_exports);
26
- var Timer = {
27
- wait: async (ms) => {
28
- return new Promise((resolve) => setTimeout(resolve, ms));
29
- }
30
- };
31
- var Timer_default = Timer;
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {});
package/dist/Timer.mjs DELETED
@@ -1,7 +0,0 @@
1
- import {
2
- Timer_default
3
- } from "./chunk-GJCAEOND.mjs";
4
- import "./chunk-ZHNGZMRD.mjs";
5
- export {
6
- Timer_default as default
7
- };
@@ -1,6 +0,0 @@
1
- declare const Validation: {
2
- imageValidate(file: Blob): boolean;
3
- videoValidate(file: Blob): boolean;
4
- };
5
-
6
- export { Validation as default };
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/Validation.ts
21
- var Validation_exports = {};
22
- __export(Validation_exports, {
23
- default: () => Validation_default
24
- });
25
- module.exports = __toCommonJS(Validation_exports);
26
- var Validation = {
27
- imageValidate(file) {
28
- var maxSize = 10;
29
- var fileSize = 1024 * 1024 * maxSize;
30
- var fileTypes = ["image/png", "image/jpeg"];
31
- if (!file || fileTypes.indexOf(file.type) < 0) {
32
- alert("Vui l\xF2ng upload \u1EA3nh \u0111\xFAng \u0111\u1ECBnh d\u1EA1ng jpg hay png");
33
- return false;
34
- } else if (file.size > fileSize) {
35
- alert("Vui l\xF2ng upload \u1EA3nh c\xF3 dung l\u01B0\u1EE3ng th\u1EA5p h\u01A1n " + maxSize + "mb");
36
- return false;
37
- }
38
- return true;
39
- },
40
- videoValidate(file) {
41
- var maxSize = 15;
42
- var fileSize = 1024 * 1024 * maxSize;
43
- var fileTypes = "video";
44
- if (!file || file.type.indexOf(fileTypes) < 0) {
45
- alert("Vui l\xF2ng upload video");
46
- return false;
47
- } else if (file.size > fileSize) {
48
- alert("Vui l\xF2ng upload video c\xF3 dung l\u01B0\u1EE3ng th\u1EA5p h\u01A1n " + maxSize + "mb");
49
- return false;
50
- }
51
- return true;
52
- }
53
- };
54
- var Validation_default = Validation;
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {});
@@ -1,35 +0,0 @@
1
- import "./chunk-ZHNGZMRD.mjs";
2
-
3
- // src/Validation.ts
4
- var Validation = {
5
- imageValidate(file) {
6
- var maxSize = 10;
7
- var fileSize = 1024 * 1024 * maxSize;
8
- var fileTypes = ["image/png", "image/jpeg"];
9
- if (!file || fileTypes.indexOf(file.type) < 0) {
10
- alert("Vui l\xF2ng upload \u1EA3nh \u0111\xFAng \u0111\u1ECBnh d\u1EA1ng jpg hay png");
11
- return false;
12
- } else if (file.size > fileSize) {
13
- alert("Vui l\xF2ng upload \u1EA3nh c\xF3 dung l\u01B0\u1EE3ng th\u1EA5p h\u01A1n " + maxSize + "mb");
14
- return false;
15
- }
16
- return true;
17
- },
18
- videoValidate(file) {
19
- var maxSize = 15;
20
- var fileSize = 1024 * 1024 * maxSize;
21
- var fileTypes = "video";
22
- if (!file || file.type.indexOf(fileTypes) < 0) {
23
- alert("Vui l\xF2ng upload video");
24
- return false;
25
- } else if (file.size > fileSize) {
26
- alert("Vui l\xF2ng upload video c\xF3 dung l\u01B0\u1EE3ng th\u1EA5p h\u01A1n " + maxSize + "mb");
27
- return false;
28
- }
29
- return true;
30
- }
31
- };
32
- var Validation_default = Validation;
33
- export {
34
- Validation_default as default
35
- };
@@ -1,158 +0,0 @@
1
- declare const sumArray: (array: [], key: string) => number;
2
- /**
3
- *
4
- * @param {Array} array
5
- * @param {string} key
6
- * @returns {Number}
7
- */
8
- declare const averageArray: (array: [], key: string) => number;
9
- /**
10
- *
11
- * @param {Array} array
12
- * @param {string} key
13
- * @returns {Number}
14
- */
15
- declare const minArray: (array: [], key: string) => number;
16
- /**
17
- *
18
- * @param {Array} array
19
- * @param {string} key
20
- * @returns {Number}
21
- */
22
- declare const maxArray: (array: [], key: string) => number;
23
- /**
24
- *
25
- * @param {Array} array
26
- * @param {string} key
27
- * @returns {Array}
28
- */
29
- declare const sortElementByString: (array: any, key: string) => any[] | undefined;
30
- /**
31
- *
32
- * @param {Array} array
33
- * @param {string} key
34
- * @returns {Array}
35
- */
36
- declare const sortElementByNumber: (array: any, key: string) => any[] | undefined;
37
- /**
38
- *
39
- * @param {Array} array
40
- * @returns {any}
41
- */
42
- declare const firstElement: (array: any[]) => any;
43
- /**
44
- *
45
- * @param {Array} array
46
- * @returns {any}
47
- */
48
- declare const lastElement: (array: any[]) => any;
49
- /**
50
- *
51
- * @param {Array} array
52
- * @returns {any}
53
- */
54
- declare const randomIndex: (array: any[]) => number;
55
- /**
56
- *
57
- * @param {Array} array
58
- * @returns {any}
59
- */
60
- declare const randomElement: (array: any[]) => any;
61
- /**
62
- * Remove same elements from 2 arrays
63
- */
64
- declare const mergeAndMakeUniqueElement: (list1: any[], list2: any[], key: string) => any[] | undefined;
65
- /**
66
- * check target == toMatch
67
- * @param {Array} target
68
- * @param {Array} toMatch
69
- * @returns {Boolean}
70
- */
71
- declare const allMatchInArray: (target: any[], toMatch: any[]) => boolean;
72
- declare const removeItem: (item: any, array: any[]) => any[];
73
- declare const removeItemByKey: (key: string, value: any, array: any[]) => any[];
74
- declare const getRandom: (array: any[], n: number) => any[];
75
- /**
76
- * Get an array with shuffle element
77
- */
78
- declare const getHalfRandom: (array: any[], n: number) => any[];
79
- /**
80
- * Make array shuffle itself
81
- */
82
- declare const shuffle: (array: any[]) => any[];
83
- /**
84
- *
85
- * @param {Array} array
86
- * @param {Number} oldIndex
87
- * @param {Number} newIndex
88
- * @returns {Array}
89
- */
90
- declare const moveIndex: (array: any[], oldIndex: number, newIndex: number) => any[];
91
- declare const moveArray: (array: any[], oldIndex: number, newIndex: number) => any[];
92
- declare const xarray: {
93
- sumArray: (array: [], key: string) => number;
94
- averageArray: (array: [], key: string) => number;
95
- minArray: (array: [], key: string) => number;
96
- maxArray: (array: [], key: string) => number;
97
- sortElementByString: (array: any, key: string) => any[] | undefined;
98
- sortElementByNumber: (array: any, key: string) => any[] | undefined;
99
- firstElement: (array: any[]) => any;
100
- lastElement: (array: any[]) => any;
101
- randomIndex: (array: any[]) => number;
102
- randomElement: (array: any[]) => any;
103
- mergeAndMakeUniqueElement: (list1: any[], list2: any[], key: string) => any[] | undefined;
104
- allMatchInArray: (target: any[], toMatch: any[]) => boolean;
105
- removeItem: (item: any, array: any[]) => any[];
106
- removeItemByKey: (key: string, value: any, array: any[]) => any[];
107
- getRandom: (array: any[], n: number) => any[];
108
- getHalfRandom: (array: any[], n: number) => any[];
109
- shuffle: (array: any[]) => any[];
110
- moveIndex: (array: any[], oldIndex: number, newIndex: number) => any[];
111
- moveArray: (array: any[], oldIndex: number, newIndex: number) => any[];
112
- };
113
-
114
- declare const array_allMatchInArray: typeof allMatchInArray;
115
- declare const array_averageArray: typeof averageArray;
116
- declare const array_firstElement: typeof firstElement;
117
- declare const array_getHalfRandom: typeof getHalfRandom;
118
- declare const array_getRandom: typeof getRandom;
119
- declare const array_lastElement: typeof lastElement;
120
- declare const array_maxArray: typeof maxArray;
121
- declare const array_mergeAndMakeUniqueElement: typeof mergeAndMakeUniqueElement;
122
- declare const array_minArray: typeof minArray;
123
- declare const array_moveArray: typeof moveArray;
124
- declare const array_moveIndex: typeof moveIndex;
125
- declare const array_randomElement: typeof randomElement;
126
- declare const array_randomIndex: typeof randomIndex;
127
- declare const array_removeItem: typeof removeItem;
128
- declare const array_removeItemByKey: typeof removeItemByKey;
129
- declare const array_shuffle: typeof shuffle;
130
- declare const array_sortElementByNumber: typeof sortElementByNumber;
131
- declare const array_sortElementByString: typeof sortElementByString;
132
- declare const array_sumArray: typeof sumArray;
133
- declare namespace array {
134
- export {
135
- array_allMatchInArray as allMatchInArray,
136
- array_averageArray as averageArray,
137
- xarray as default,
138
- array_firstElement as firstElement,
139
- array_getHalfRandom as getHalfRandom,
140
- array_getRandom as getRandom,
141
- array_lastElement as lastElement,
142
- array_maxArray as maxArray,
143
- array_mergeAndMakeUniqueElement as mergeAndMakeUniqueElement,
144
- array_minArray as minArray,
145
- array_moveArray as moveArray,
146
- array_moveIndex as moveIndex,
147
- array_randomElement as randomElement,
148
- array_randomIndex as randomIndex,
149
- array_removeItem as removeItem,
150
- array_removeItemByKey as removeItemByKey,
151
- array_shuffle as shuffle,
152
- array_sortElementByNumber as sortElementByNumber,
153
- array_sortElementByString as sortElementByString,
154
- array_sumArray as sumArray,
155
- };
156
- }
157
-
158
- export { array as a, averageArray as b, maxArray as c, sortElementByString as d, sortElementByNumber as e, firstElement as f, randomElement as g, mergeAndMakeUniqueElement as h, allMatchInArray as i, removeItem as j, removeItemByKey as k, lastElement as l, minArray as m, getRandom as n, getHalfRandom as o, shuffle as p, moveIndex as q, randomIndex as r, sumArray as s, moveArray as t, xarray as x };
package/dist/array.d.ts DELETED
@@ -1 +0,0 @@
1
- export { i as allMatchInArray, b as averageArray, x as default, f as firstElement, o as getHalfRandom, n as getRandom, l as lastElement, c as maxArray, h as mergeAndMakeUniqueElement, m as minArray, t as moveArray, q as moveIndex, g as randomElement, r as randomIndex, j as removeItem, k as removeItemByKey, p as shuffle, e as sortElementByNumber, d as sortElementByString, s as sumArray } from './array-dc599632.js';
package/dist/array.js DELETED
@@ -1,277 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/array.ts
21
- var array_exports = {};
22
- __export(array_exports, {
23
- allMatchInArray: () => allMatchInArray,
24
- averageArray: () => averageArray,
25
- default: () => array_default,
26
- firstElement: () => firstElement,
27
- getHalfRandom: () => getHalfRandom,
28
- getRandom: () => getRandom,
29
- lastElement: () => lastElement,
30
- maxArray: () => maxArray,
31
- mergeAndMakeUniqueElement: () => mergeAndMakeUniqueElement,
32
- minArray: () => minArray,
33
- moveArray: () => moveArray,
34
- moveIndex: () => moveIndex,
35
- randomElement: () => randomElement,
36
- randomIndex: () => randomIndex,
37
- removeItem: () => removeItem,
38
- removeItemByKey: () => removeItemByKey,
39
- shuffle: () => shuffle,
40
- sortElementByNumber: () => sortElementByNumber,
41
- sortElementByString: () => sortElementByString,
42
- sumArray: () => sumArray
43
- });
44
- module.exports = __toCommonJS(array_exports);
45
-
46
- // src/math/index.ts
47
- var DEG2RAD = Math.PI / 180;
48
- var RAD2DEG = 180 / Math.PI;
49
- var randInt = (low, high) => {
50
- return low + Math.floor(Math.random() * (high - low + 1));
51
- };
52
-
53
- // src/array.ts
54
- var sumArray = (array, key) => {
55
- if (!array) {
56
- console.warn("ARRAY NOT EXITED !");
57
- return 0;
58
- }
59
- if (key)
60
- return array.reduce((c, v) => c + v[key], 0);
61
- else
62
- return array.reduce((c, v) => c + v, 0);
63
- };
64
- var averageArray = (array, key) => {
65
- if (!array) {
66
- console.warn("ARRAY NOT EXITED !");
67
- return 0;
68
- }
69
- return sumArray(array, key) / array.length || 0;
70
- };
71
- var minArray = (array, key) => {
72
- if (!array) {
73
- console.warn("ARRAY NOT EXITED !");
74
- return 0;
75
- }
76
- if (array.length > 0) {
77
- if (key)
78
- return array.reduce((c, v) => c < v[key] ? c : v[key]);
79
- else
80
- return array.reduce((c, v) => c < v ? c : v);
81
- }
82
- return 0;
83
- };
84
- var maxArray = (array, key) => {
85
- if (!array) {
86
- console.warn("ARRAY NOT EXITED !");
87
- return 0;
88
- }
89
- if (array.length > 0) {
90
- if (key)
91
- return array.reduce((c, v) => c > v[key] ? c : v[key]);
92
- else
93
- return array.reduce((c, v) => c > v ? c : v);
94
- }
95
- return 0;
96
- };
97
- var sortElementByString = (array, key) => {
98
- if (!Array.isArray(array))
99
- return [];
100
- if (key)
101
- return array.sort((x, y) => {
102
- var a = x[key].toUpperCase(), b = y[key].toUpperCase();
103
- return a == b ? 0 : a > b ? 1 : -1;
104
- });
105
- console.log("NO KEY");
106
- };
107
- var sortElementByNumber = (array, key) => {
108
- if (!Array.isArray(array))
109
- return [];
110
- if (key)
111
- return array.sort((a, b) => {
112
- return a[key] - b[key];
113
- });
114
- console.log("NO KEY");
115
- };
116
- var firstElement = (array) => {
117
- if (array) {
118
- if (array.length || array.length > 0)
119
- return array[0];
120
- }
121
- return null;
122
- };
123
- var lastElement = (array) => {
124
- if (array) {
125
- if (array.length || array.length > 0)
126
- return array[array.length - 1];
127
- }
128
- return null;
129
- };
130
- var randomIndex = (array) => {
131
- if (array)
132
- return randInt(0, array.length - 1);
133
- return -1;
134
- };
135
- var randomElement = (array) => {
136
- if (array)
137
- return array[randomIndex(array)];
138
- return null;
139
- };
140
- var mergeAndMakeUniqueElement = (list1, list2, key) => {
141
- if (!list1 || !list2)
142
- return;
143
- if (key) {
144
- return list1.concat(list2).filter((item, index, self) => {
145
- return self.findIndex((x) => x[key] == item[key]) === index;
146
- });
147
- } else {
148
- return list1.concat(list2).filter((x, index, self) => {
149
- return self.indexOf(x) === index;
150
- });
151
- }
152
- };
153
- var allMatchInArray = (target, toMatch) => {
154
- if (!target || !toMatch)
155
- return false;
156
- const found = toMatch.every((item) => {
157
- return target.includes(item);
158
- });
159
- return found;
160
- };
161
- var removeItem = (item, array) => {
162
- const index = array.indexOf(item);
163
- if (index == -1) {
164
- console.warn("[ArrayExtra.removeItem] Item not found.");
165
- return array;
166
- }
167
- array.splice(index, 1);
168
- return array;
169
- };
170
- var removeItemByKey = (key, value, array) => {
171
- const foundIndex = array.findIndex((item) => {
172
- return item[key] == value;
173
- });
174
- if (foundIndex < 0) {
175
- console.warn("[ArrayExtra.removeItemByKey] Item not found.", key, value);
176
- return array;
177
- }
178
- array.splice(foundIndex, 1);
179
- return array;
180
- };
181
- var getRandom = (array, n) => {
182
- var result = new Array(n), len = array.length, taken = new Array(len);
183
- if (n > len)
184
- throw new RangeError("getRandom: more elements taken than available");
185
- while (n--) {
186
- var x = Math.floor(Math.random() * len);
187
- result[n] = array[x in taken ? taken[x] : x];
188
- taken[x] = --len in taken ? taken[len] : len;
189
- }
190
- return result;
191
- };
192
- var getHalfRandom = (array, n) => {
193
- var n = Math.ceil(array.length / 2);
194
- return getRandom(array, n);
195
- };
196
- var shuffle = (array) => {
197
- var i = array.length, j, temp;
198
- if (array.length < 1)
199
- return array;
200
- while (--i) {
201
- j = Math.floor(Math.random() * (i + 1));
202
- temp = array[i];
203
- array[i] = array[j];
204
- array[j] = temp;
205
- }
206
- return array;
207
- };
208
- var moveIndex = (array, oldIndex, newIndex) => {
209
- if (newIndex >= array.length) {
210
- var k = newIndex - array.length + 1;
211
- while (k--) {
212
- array.push(void 0);
213
- }
214
- }
215
- array.splice(newIndex, 0, array.splice(oldIndex, 1)[0]);
216
- return array;
217
- };
218
- var moveArray = (array, oldIndex, newIndex) => {
219
- while (oldIndex < 0) {
220
- oldIndex += array.length;
221
- }
222
- while (newIndex < 0) {
223
- newIndex += array.length;
224
- }
225
- if (newIndex >= array.length) {
226
- var k = newIndex - array.length;
227
- while (k-- + 1) {
228
- array.push(999);
229
- }
230
- }
231
- array.splice(newIndex, 0, array.splice(oldIndex, 1)[0]);
232
- return array;
233
- };
234
- var xarray = {
235
- sumArray,
236
- averageArray,
237
- minArray,
238
- maxArray,
239
- sortElementByString,
240
- sortElementByNumber,
241
- firstElement,
242
- lastElement,
243
- randomIndex,
244
- randomElement,
245
- mergeAndMakeUniqueElement,
246
- allMatchInArray,
247
- removeItem,
248
- removeItemByKey,
249
- getRandom,
250
- getHalfRandom,
251
- shuffle,
252
- moveIndex,
253
- moveArray
254
- };
255
- var array_default = xarray;
256
- // Annotate the CommonJS export names for ESM import in node:
257
- 0 && (module.exports = {
258
- allMatchInArray,
259
- averageArray,
260
- firstElement,
261
- getHalfRandom,
262
- getRandom,
263
- lastElement,
264
- maxArray,
265
- mergeAndMakeUniqueElement,
266
- minArray,
267
- moveArray,
268
- moveIndex,
269
- randomElement,
270
- randomIndex,
271
- removeItem,
272
- removeItemByKey,
273
- shuffle,
274
- sortElementByNumber,
275
- sortElementByString,
276
- sumArray
277
- });
package/dist/array.mjs DELETED
@@ -1,49 +0,0 @@
1
- import {
2
- allMatchInArray,
3
- array_default,
4
- averageArray,
5
- firstElement,
6
- getHalfRandom,
7
- getRandom,
8
- lastElement,
9
- maxArray,
10
- mergeAndMakeUniqueElement,
11
- minArray,
12
- moveArray,
13
- moveIndex,
14
- randomElement,
15
- randomIndex,
16
- removeItem,
17
- removeItemByKey,
18
- shuffle,
19
- sortElementByNumber,
20
- sortElementByString,
21
- sumArray
22
- } from "./chunk-OYRPWQUA.mjs";
23
- import "./chunk-6GNGTFNC.mjs";
24
- import "./chunk-VFG5VU6S.mjs";
25
- import "./chunk-JEI7BOXY.mjs";
26
- import "./chunk-5UEMANWE.mjs";
27
- import "./chunk-ZHNGZMRD.mjs";
28
- export {
29
- allMatchInArray,
30
- averageArray,
31
- array_default as default,
32
- firstElement,
33
- getHalfRandom,
34
- getRandom,
35
- lastElement,
36
- maxArray,
37
- mergeAndMakeUniqueElement,
38
- minArray,
39
- moveArray,
40
- moveIndex,
41
- randomElement,
42
- randomIndex,
43
- removeItem,
44
- removeItemByKey,
45
- shuffle,
46
- sortElementByNumber,
47
- sortElementByString,
48
- sumArray
49
- };
@@ -1,22 +0,0 @@
1
- declare const isPotrait: () => boolean;
2
- declare const isLandscape: () => boolean;
3
- declare const ua: () => any;
4
- declare const isFacebookWebview: () => boolean | undefined;
5
- declare const isInAppWebview: () => boolean;
6
-
7
- declare const browser_isFacebookWebview: typeof isFacebookWebview;
8
- declare const browser_isInAppWebview: typeof isInAppWebview;
9
- declare const browser_isLandscape: typeof isLandscape;
10
- declare const browser_isPotrait: typeof isPotrait;
11
- declare const browser_ua: typeof ua;
12
- declare namespace browser {
13
- export {
14
- browser_isFacebookWebview as isFacebookWebview,
15
- browser_isInAppWebview as isInAppWebview,
16
- browser_isLandscape as isLandscape,
17
- browser_isPotrait as isPotrait,
18
- browser_ua as ua,
19
- };
20
- }
21
-
22
- export { isLandscape as a, browser as b, isFacebookWebview as c, isInAppWebview as d, isPotrait as i, ua as u };
@@ -1,15 +0,0 @@
1
- type GetWebcamParams = {
2
- container?: HTMLElement;
3
- facingMode: string;
4
- audio: boolean;
5
- };
6
- declare function getWebcam(params?: GetWebcamParams): Promise<unknown> | undefined;
7
-
8
- declare const camera_getWebcam: typeof getWebcam;
9
- declare namespace camera {
10
- export {
11
- camera_getWebcam as getWebcam,
12
- };
13
- }
14
-
15
- export { camera as c, getWebcam as g };