diginext-utils 2.0.33 → 2.0.36

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 (359) hide show
  1. package/dist/Checker.d.ts +3 -4
  2. package/dist/Checker.js +32 -52
  3. package/dist/Checker.js.map +1 -0
  4. package/dist/EventDispatcher.d.ts +3 -3
  5. package/dist/EventDispatcher.js +52 -77
  6. package/dist/EventDispatcher.js.map +1 -0
  7. package/dist/FileUpload.d.ts +3 -3
  8. package/dist/FileUpload.js +65 -85
  9. package/dist/FileUpload.js.map +1 -0
  10. package/dist/Slug.d.ts +3 -4
  11. package/dist/Slug.js +334 -354
  12. package/dist/Slug.js.map +1 -0
  13. package/dist/Timer.d.ts +4 -1
  14. package/dist/Timer.js +9 -33
  15. package/dist/Timer.js.map +1 -0
  16. package/dist/Validation.d.ts +2 -3
  17. package/dist/Validation.js +39 -56
  18. package/dist/Validation.js.map +1 -0
  19. package/dist/array.d.ts +113 -1
  20. package/dist/array.js +297 -277
  21. package/dist/array.js.map +1 -0
  22. package/dist/color.d.ts +8 -9
  23. package/dist/color.js +89 -106
  24. package/dist/color.js.map +1 -0
  25. package/dist/console/enableConsole.d.ts +2 -1
  26. package/dist/console/enableConsole.js +14 -42
  27. package/dist/console/enableConsole.js.map +1 -0
  28. package/dist/console/index.d.ts +11 -2
  29. package/dist/console/index.js +18 -61
  30. package/dist/console/index.js.map +1 -0
  31. package/dist/console/log.d.ts +8 -9
  32. package/dist/console/log.js +45 -75
  33. package/dist/console/log.js.map +1 -0
  34. package/dist/device/browser.d.ts +5 -1
  35. package/dist/device/browser.js +38 -66
  36. package/dist/device/browser.js.map +1 -0
  37. package/dist/device/camera.d.ts +7 -1
  38. package/dist/device/camera.js +172 -190
  39. package/dist/device/camera.js.map +1 -0
  40. package/dist/device/index.d.ts +5 -1
  41. package/dist/device/index.js +225 -210
  42. package/dist/device/index.js.map +1 -0
  43. package/dist/device/os.d.ts +6 -7
  44. package/dist/device/os.js +38 -65
  45. package/dist/device/os.js.map +1 -0
  46. package/dist/file/createDir.d.ts +5 -1
  47. package/dist/file/createDir.js +16 -37
  48. package/dist/file/createDir.js.map +1 -0
  49. package/dist/file/fileMove.d.ts +4 -1
  50. package/dist/file/fileMove.js +33 -53
  51. package/dist/file/fileMove.js.map +1 -0
  52. package/dist/file/findFilesByExt.d.ts +13 -1
  53. package/dist/file/findFilesByExt.js +50 -69
  54. package/dist/file/findFilesByExt.js.map +1 -0
  55. package/dist/file/index.d.ts +4 -6
  56. package/dist/file/index.js +11 -106
  57. package/dist/file/index.js.map +1 -0
  58. package/dist/images/index.d.ts +2 -2
  59. package/dist/images/index.js +9 -132
  60. package/dist/images/index.js.map +1 -0
  61. package/dist/images/loadImage.d.ts +1 -3
  62. package/dist/images/loadImage.js +18 -42
  63. package/dist/images/loadImage.js.map +1 -0
  64. package/dist/images/resize.d.ts +2 -3
  65. package/dist/images/resize.js +38 -64
  66. package/dist/images/resize.js.map +1 -0
  67. package/dist/images/upload.d.ts +3 -4
  68. package/dist/images/upload.js +27 -132
  69. package/dist/images/upload.js.map +1 -0
  70. package/dist/index.d.ts +19 -30
  71. package/dist/index.js +63 -1353
  72. package/dist/index.js.map +1 -0
  73. package/dist/json.d.ts +3 -4
  74. package/dist/json.js +32 -52
  75. package/dist/json.js.map +1 -0
  76. package/dist/math/diffDate.d.ts +2 -3
  77. package/dist/math/diffDate.js +14 -36
  78. package/dist/math/diffDate.js.map +1 -0
  79. package/dist/math/index.d.ts +30 -3
  80. package/dist/math/index.js +93 -160
  81. package/dist/math/index.js.map +1 -0
  82. package/dist/math/positiveNumber.d.ts +2 -3
  83. package/dist/math/positiveNumber.js +17 -56
  84. package/dist/math/positiveNumber.js.map +1 -0
  85. package/dist/name/en.d.ts +3 -4
  86. package/dist/name/en.js +26 -44
  87. package/dist/name/en.js.map +1 -0
  88. package/dist/name/index.d.ts +12 -3
  89. package/dist/name/index.js +13 -88
  90. package/dist/name/index.js.map +1 -0
  91. package/dist/name/vi.d.ts +3 -4
  92. package/dist/name/vi.js +28 -66
  93. package/dist/name/vi.js.map +1 -0
  94. package/dist/object.d.ts +59 -1
  95. package/dist/object.js +80 -105
  96. package/dist/object.js.map +1 -0
  97. package/dist/permission/index.d.ts +2 -3
  98. package/dist/permission/index.js +7 -231
  99. package/dist/permission/index.js.map +1 -0
  100. package/dist/permission/requestCamera.d.ts +5 -1
  101. package/dist/permission/requestCamera.js +43 -54
  102. package/dist/permission/requestCamera.js.map +1 -0
  103. package/dist/permission/requestDeviceOrientationControl.d.ts +2 -1
  104. package/dist/permission/requestDeviceOrientationControl.js +39 -206
  105. package/dist/permission/requestDeviceOrientationControl.js.map +1 -0
  106. package/dist/response/index.d.ts +6 -7
  107. package/dist/response/index.js +52 -97
  108. package/dist/response/index.js.map +1 -0
  109. package/dist/string/formatNumber.d.ts +2 -3
  110. package/dist/string/formatNumber.js +15 -56
  111. package/dist/string/formatNumber.js.map +1 -0
  112. package/dist/string/generatePassword.d.ts +2 -3
  113. package/dist/string/generatePassword.js +24 -55
  114. package/dist/string/generatePassword.js.map +1 -0
  115. package/dist/string/generateUUID.d.ts +2 -3
  116. package/dist/string/generateUUID.js +37 -40
  117. package/dist/string/generateUUID.js.map +1 -0
  118. package/dist/string/index.d.ts +65 -6
  119. package/dist/string/index.js +161 -316
  120. package/dist/string/index.js.map +1 -0
  121. package/dist/string/makeDaySlug.d.ts +3 -4
  122. package/dist/string/makeDaySlug.js +23 -47
  123. package/dist/string/makeDaySlug.js.map +1 -0
  124. package/dist/string/random.d.ts +8 -9
  125. package/dist/string/random.js +25 -56
  126. package/dist/string/random.js.map +1 -0
  127. package/dist/string/trimNull.d.ts +2 -3
  128. package/dist/string/trimNull.js +21 -49
  129. package/dist/string/trimNull.js.map +1 -0
  130. package/dist/string/url.d.ts +36 -1
  131. package/dist/string/url.js +107 -126
  132. package/dist/string/url.js.map +1 -0
  133. package/esm/Checker.d.ts +8 -0
  134. package/esm/Checker.js +28 -0
  135. package/esm/Checker.js.map +1 -0
  136. package/esm/EventDispatcher.d.ts +13 -0
  137. package/esm/EventDispatcher.js +49 -0
  138. package/esm/EventDispatcher.js.map +1 -0
  139. package/esm/FileUpload.d.ts +12 -0
  140. package/esm/FileUpload.js +62 -0
  141. package/esm/FileUpload.js.map +1 -0
  142. package/esm/Slug.d.ts +9 -0
  143. package/esm/Slug.js +330 -0
  144. package/esm/Slug.js.map +1 -0
  145. package/esm/Timer.d.ts +4 -0
  146. package/esm/Timer.js +7 -0
  147. package/esm/Timer.js.map +1 -0
  148. package/esm/Validation.d.ts +5 -0
  149. package/esm/Validation.js +37 -0
  150. package/esm/Validation.js.map +1 -0
  151. package/esm/array.d.ts +113 -0
  152. package/esm/array.js +275 -0
  153. package/esm/array.js.map +1 -0
  154. package/esm/color.d.ts +23 -0
  155. package/esm/color.js +80 -0
  156. package/esm/color.js.map +1 -0
  157. package/esm/console/enableConsole.d.ts +2 -0
  158. package/esm/console/enableConsole.js +7 -0
  159. package/esm/console/enableConsole.js.map +1 -0
  160. package/esm/console/index.d.ts +11 -0
  161. package/esm/console/index.js +13 -0
  162. package/esm/console/index.js.map +1 -0
  163. package/esm/console/log.d.ts +15 -0
  164. package/esm/console/log.js +33 -0
  165. package/esm/console/log.js.map +1 -0
  166. package/esm/device/browser.d.ts +5 -0
  167. package/esm/device/browser.js +30 -0
  168. package/esm/device/browser.js.map +1 -0
  169. package/esm/device/camera.d.ts +7 -0
  170. package/esm/device/camera.js +168 -0
  171. package/esm/device/camera.js.map +1 -0
  172. package/esm/device/index.d.ts +5 -0
  173. package/esm/device/index.js +217 -0
  174. package/esm/device/index.js.map +1 -0
  175. package/esm/device/os.d.ts +11 -0
  176. package/esm/device/os.js +28 -0
  177. package/esm/device/os.js.map +1 -0
  178. package/esm/file/createDir.d.ts +5 -0
  179. package/esm/file/createDir.js +13 -0
  180. package/esm/file/createDir.js.map +1 -0
  181. package/esm/file/fileMove.d.ts +4 -0
  182. package/esm/file/fileMove.js +29 -0
  183. package/esm/file/fileMove.js.map +1 -0
  184. package/esm/file/findFilesByExt.d.ts +13 -0
  185. package/esm/file/findFilesByExt.js +46 -0
  186. package/esm/file/findFilesByExt.js.map +1 -0
  187. package/esm/file/index.d.ts +9 -0
  188. package/esm/file/index.js +6 -0
  189. package/esm/file/index.js.map +1 -0
  190. package/esm/images/index.d.ts +2 -0
  191. package/esm/images/index.js +4 -0
  192. package/esm/images/index.js.map +1 -0
  193. package/esm/images/loadImage.d.ts +1 -0
  194. package/esm/images/loadImage.js +15 -0
  195. package/esm/images/loadImage.js.map +1 -0
  196. package/esm/images/resize.d.ts +2 -0
  197. package/esm/images/resize.js +31 -0
  198. package/esm/images/resize.js.map +1 -0
  199. package/esm/images/upload.d.ts +10 -0
  200. package/esm/images/upload.js +20 -0
  201. package/esm/images/upload.js.map +1 -0
  202. package/esm/index.d.ts +37 -0
  203. package/esm/index.js +38 -0
  204. package/esm/index.js.map +1 -0
  205. package/esm/json.d.ts +8 -0
  206. package/esm/json.js +28 -0
  207. package/esm/json.js.map +1 -0
  208. package/esm/math/diffDate.d.ts +5 -0
  209. package/esm/math/diffDate.js +10 -0
  210. package/esm/math/diffDate.js.map +1 -0
  211. package/esm/math/index.d.ts +30 -0
  212. package/esm/math/index.js +78 -0
  213. package/esm/math/index.js.map +1 -0
  214. package/esm/math/positiveNumber.d.ts +2 -0
  215. package/esm/math/positiveNumber.js +13 -0
  216. package/esm/math/positiveNumber.js.map +1 -0
  217. package/esm/name/en.d.ts +5 -0
  218. package/esm/name/en.js +22 -0
  219. package/esm/name/en.js.map +1 -0
  220. package/esm/name/index.d.ts +12 -0
  221. package/esm/name/index.js +6 -0
  222. package/esm/name/index.js.map +1 -0
  223. package/esm/name/vi.d.ts +5 -0
  224. package/esm/name/vi.js +24 -0
  225. package/esm/name/vi.js.map +1 -0
  226. package/{dist/object-43aaaf92.d.ts → esm/object.d.ts} +9 -30
  227. package/esm/object.js +70 -0
  228. package/esm/object.js.map +1 -0
  229. package/esm/permission/index.d.ts +8 -0
  230. package/esm/permission/index.js +5 -0
  231. package/esm/permission/index.js.map +1 -0
  232. package/esm/permission/requestCamera.d.ts +5 -0
  233. package/esm/permission/requestCamera.js +39 -0
  234. package/esm/permission/requestCamera.js.map +1 -0
  235. package/esm/permission/requestDeviceOrientationControl.d.ts +2 -0
  236. package/esm/permission/requestDeviceOrientationControl.js +35 -0
  237. package/esm/permission/requestDeviceOrientationControl.js.map +1 -0
  238. package/esm/response/index.d.ts +49 -0
  239. package/esm/response/index.js +46 -0
  240. package/esm/response/index.js.map +1 -0
  241. package/esm/string/formatNumber.d.ts +6 -0
  242. package/esm/string/formatNumber.js +11 -0
  243. package/esm/string/formatNumber.js.map +1 -0
  244. package/esm/string/generatePassword.d.ts +9 -0
  245. package/esm/string/generatePassword.js +20 -0
  246. package/esm/string/generatePassword.js.map +1 -0
  247. package/esm/string/generateUUID.d.ts +2 -0
  248. package/esm/string/generateUUID.js +33 -0
  249. package/esm/string/generateUUID.js.map +1 -0
  250. package/esm/string/index.d.ts +65 -0
  251. package/esm/string/index.js +150 -0
  252. package/esm/string/index.js.map +1 -0
  253. package/esm/string/makeDaySlug.d.ts +31 -0
  254. package/esm/string/makeDaySlug.js +16 -0
  255. package/esm/string/makeDaySlug.js.map +1 -0
  256. package/esm/string/random.d.ts +14 -0
  257. package/esm/string/random.js +20 -0
  258. package/esm/string/random.js.map +1 -0
  259. package/esm/string/trimNull.d.ts +2 -0
  260. package/esm/string/trimNull.js +14 -0
  261. package/esm/string/trimNull.js.map +1 -0
  262. package/esm/string/url.d.ts +36 -0
  263. package/esm/string/url.js +97 -0
  264. package/esm/string/url.js.map +1 -0
  265. package/package.json +1 -1
  266. package/src/console/index.ts +2 -2
  267. package/src/string/url.ts +2 -2
  268. package/dist/Checker.mjs +0 -29
  269. package/dist/EventDispatcher.mjs +0 -54
  270. package/dist/FileUpload.mjs +0 -62
  271. package/dist/Slug.mjs +0 -331
  272. package/dist/Timer-7b0c4e7c.d.ts +0 -11
  273. package/dist/Timer.mjs +0 -7
  274. package/dist/Validation.mjs +0 -35
  275. package/dist/array-dc599632.d.ts +0 -158
  276. package/dist/array.mjs +0 -49
  277. package/dist/browser-8d042ffe.d.ts +0 -22
  278. package/dist/camera-1a859d72.d.ts +0 -15
  279. package/dist/chunk-5NTK5JAI.mjs +0 -57
  280. package/dist/chunk-5UEMANWE.mjs +0 -91
  281. package/dist/chunk-5ZOWNKSD.mjs +0 -166
  282. package/dist/chunk-6GNGTFNC.mjs +0 -118
  283. package/dist/chunk-7MK72U4O.mjs +0 -19
  284. package/dist/chunk-7XKT3AQX.mjs +0 -17
  285. package/dist/chunk-7ZCEZM7K.mjs +0 -41
  286. package/dist/chunk-AMBWJGSW.mjs +0 -151
  287. package/dist/chunk-C7S43KGB.mjs +0 -15
  288. package/dist/chunk-CJM7T7ON.mjs +0 -24
  289. package/dist/chunk-CKILLYAP.mjs +0 -16
  290. package/dist/chunk-DX7MUT3M.mjs +0 -51
  291. package/dist/chunk-EGUJQ5VF.mjs +0 -32
  292. package/dist/chunk-ETEIHDWU.mjs +0 -25
  293. package/dist/chunk-FJXSVGL7.mjs +0 -22
  294. package/dist/chunk-GJCAEOND.mjs +0 -20
  295. package/dist/chunk-GNJDIUYM.mjs +0 -40
  296. package/dist/chunk-IA7GINWD.mjs +0 -39
  297. package/dist/chunk-JEI7BOXY.mjs +0 -21
  298. package/dist/chunk-K4KENOE6.mjs +0 -20
  299. package/dist/chunk-KMERW6KS.mjs +0 -34
  300. package/dist/chunk-KPO3RH5G.mjs +0 -27
  301. package/dist/chunk-KWG5LYNK.mjs +0 -100
  302. package/dist/chunk-NUTQDHLQ.mjs +0 -40
  303. package/dist/chunk-O64XUDAH.mjs +0 -35
  304. package/dist/chunk-OYRPWQUA.mjs +0 -257
  305. package/dist/chunk-PNZ4KGXL.mjs +0 -56
  306. package/dist/chunk-QZYX26HT.mjs +0 -24
  307. package/dist/chunk-RDGP2CKM.mjs +0 -195
  308. package/dist/chunk-VFG5VU6S.mjs +0 -12
  309. package/dist/chunk-X3IMFCZG.mjs +0 -23
  310. package/dist/chunk-ZHNGZMRD.mjs +0 -17
  311. package/dist/color.mjs +0 -78
  312. package/dist/console/enableConsole.mjs +0 -9
  313. package/dist/console/index.mjs +0 -14
  314. package/dist/console/log.mjs +0 -19
  315. package/dist/createDir-220e0081.d.ts +0 -13
  316. package/dist/device/browser.mjs +0 -15
  317. package/dist/device/camera.mjs +0 -8
  318. package/dist/device/index.mjs +0 -15
  319. package/dist/device/os.mjs +0 -33
  320. package/dist/enableConsole-ddc24282.d.ts +0 -11
  321. package/dist/file/createDir.mjs +0 -7
  322. package/dist/file/fileMove.mjs +0 -7
  323. package/dist/file/findFilesByExt.mjs +0 -11
  324. package/dist/file/index.mjs +0 -17
  325. package/dist/fileMove-3a09e429.d.ts +0 -13
  326. package/dist/findFilesByExt-753e91d7.d.ts +0 -24
  327. package/dist/images/index.mjs +0 -15
  328. package/dist/images/loadImage.mjs +0 -21
  329. package/dist/images/resize.mjs +0 -9
  330. package/dist/images/upload.mjs +0 -14
  331. package/dist/index-1f738e52.d.ts +0 -22
  332. package/dist/index-22309f0c.d.ts +0 -23
  333. package/dist/index-6ae3c86b.d.ts +0 -63
  334. package/dist/index-c8fffc86.d.ts +0 -90
  335. package/dist/index-d652ed2c.d.ts +0 -26
  336. package/dist/index.mjs +0 -87
  337. package/dist/json.mjs +0 -29
  338. package/dist/math/diffDate.mjs +0 -9
  339. package/dist/math/index.mjs +0 -34
  340. package/dist/math/positiveNumber.mjs +0 -10
  341. package/dist/name/en.mjs +0 -9
  342. package/dist/name/index.mjs +0 -20
  343. package/dist/name/vi.mjs +0 -14
  344. package/dist/object.mjs +0 -21
  345. package/dist/permission/index.mjs +0 -15
  346. package/dist/permission/requestCamera.mjs +0 -9
  347. package/dist/permission/requestDeviceOrientationControl.mjs +0 -10
  348. package/dist/requestCamera-32b7dfc7.d.ts +0 -14
  349. package/dist/requestDeviceOrientationControl-b6458660.d.ts +0 -11
  350. package/dist/response/index.mjs +0 -16
  351. package/dist/string/formatNumber.mjs +0 -10
  352. package/dist/string/generatePassword.mjs +0 -10
  353. package/dist/string/generateUUID.mjs +0 -9
  354. package/dist/string/index.mjs +0 -31
  355. package/dist/string/makeDaySlug.mjs +0 -9
  356. package/dist/string/random.mjs +0 -19
  357. package/dist/string/trimNull.mjs +0 -9
  358. package/dist/string/url.mjs +0 -22
  359. package/dist/url-60657387.d.ts +0 -57
@@ -1,37 +1,16 @@
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/file/createDir.ts
21
- var createDir_exports = {};
22
- __export(createDir_exports, {
23
- createDir: () => createDir
24
- });
25
- module.exports = __toCommonJS(createDir_exports);
26
- var fs = require("fs");
27
- function createDir(path) {
28
- if (fs.existsSync(path)) {
29
- console.log("directory already exited !");
30
- return true;
31
- }
32
- fs.mkdirSync(path, { recursive: true });
33
- }
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- createDir
37
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDir = void 0;
4
+ const fs = require("fs");
5
+ /**
6
+ * Create new directory
7
+ */
8
+ function createDir(path) {
9
+ if (fs.existsSync(path)) {
10
+ console.log("directory already exited !");
11
+ return true;
12
+ }
13
+ fs.mkdirSync(path, { recursive: true });
14
+ }
15
+ exports.createDir = createDir;
16
+ //# sourceMappingURL=createDir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDir.js","sourceRoot":"","sources":["../../src/file/createDir.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB;;GAEG;AACH,SAAS,SAAS,CAAC,IAAY;IAC9B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;KACZ;IACD,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC;AAEQ,8BAAS"}
@@ -1 +1,4 @@
1
- export { a as fileMove } from '../fileMove-3a09e429.js';
1
+ /**
2
+ * Move file to another location.
3
+ */
4
+ export declare function fileMove(oldPath: string, newPath: string, callback: any): void;
@@ -1,53 +1,33 @@
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/file/fileMove.ts
21
- var fileMove_exports = {};
22
- __export(fileMove_exports, {
23
- fileMove: () => fileMove
24
- });
25
- module.exports = __toCommonJS(fileMove_exports);
26
- var fs = require("fs");
27
- function fileMove(oldPath, newPath, callback) {
28
- fs.rename(oldPath, newPath, function(err) {
29
- if (err) {
30
- if (err.code === "EXDEV") {
31
- copy();
32
- } else {
33
- callback(err);
34
- }
35
- return;
36
- }
37
- callback();
38
- });
39
- function copy() {
40
- var readStream = fs.createReadStream(oldPath);
41
- var writeStream = fs.createWriteStream(newPath);
42
- readStream.on("error", callback);
43
- writeStream.on("error", callback);
44
- readStream.on("close", function() {
45
- fs.unlink(oldPath, callback);
46
- });
47
- readStream.pipe(writeStream);
48
- }
49
- }
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- fileMove
53
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fileMove = void 0;
4
+ const fs = require("fs");
5
+ /**
6
+ * Move file to another location.
7
+ */
8
+ function fileMove(oldPath, newPath, callback) {
9
+ fs.rename(oldPath, newPath, function (err) {
10
+ if (err) {
11
+ if (err.code === "EXDEV") {
12
+ copy();
13
+ }
14
+ else {
15
+ callback(err);
16
+ }
17
+ return;
18
+ }
19
+ callback();
20
+ });
21
+ function copy() {
22
+ var readStream = fs.createReadStream(oldPath);
23
+ var writeStream = fs.createWriteStream(newPath);
24
+ readStream.on("error", callback);
25
+ writeStream.on("error", callback);
26
+ readStream.on("close", function () {
27
+ fs.unlink(oldPath, callback);
28
+ });
29
+ readStream.pipe(writeStream);
30
+ }
31
+ }
32
+ exports.fileMove = fileMove;
33
+ //# sourceMappingURL=fileMove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileMove.js","sourceRoot":"","sources":["../../src/file/fileMove.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAe,EAAE,OAAe,EAAE,QAAa;IACvE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,GAAQ;QAC7C,IAAI,GAAG,EAAE;YACR,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE;gBACzB,IAAI,EAAE,CAAC;aACP;iBAAM;gBACN,QAAQ,CAAC,GAAG,CAAC,CAAC;aACd;YACD,OAAO;SACP;QACD,QAAQ,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,SAAS,IAAI;QACZ,IAAI,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,WAAW,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEhD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAElC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;YACtB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9B,CAAC;AACF,CAAC;AA1BD,4BA0BC"}
@@ -1 +1,13 @@
1
- export { a as default, c as findFileByExt, b as forEachFileByExt } from '../findFilesByExt-753e91d7.js';
1
+ /**
2
+ * This is an alias of "findFileByExt()"
3
+ */
4
+ export declare const forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
5
+ /**
6
+ * This is an alias of "forEachFileByExt()"
7
+ */
8
+ export declare const findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
9
+ declare const fileExt: {
10
+ findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
11
+ forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
12
+ };
13
+ export default fileExt;
@@ -1,69 +1,50 @@
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/file/findFilesByExt.ts
21
- var findFilesByExt_exports = {};
22
- __export(findFilesByExt_exports, {
23
- default: () => findFilesByExt_default,
24
- findFileByExt: () => findFileByExt,
25
- forEachFileByExt: () => forEachFileByExt
26
- });
27
- module.exports = __toCommonJS(findFilesByExt_exports);
28
- var path = require("path");
29
- var fs = require("fs");
30
- var forEachFileByExt = (base, ext, cb) => {
31
- var walk = function(directoryName) {
32
- try {
33
- fs.readdir(directoryName, function(e, files) {
34
- if (e) {
35
- console.log("Error: ", e);
36
- return;
37
- }
38
- files.forEach(function(file) {
39
- var fullPath = path.join(directoryName, file);
40
- fs.stat(fullPath, function(e2, f) {
41
- if (e2) {
42
- console.log("Error: ", e2);
43
- return;
44
- }
45
- if (f.isDirectory()) {
46
- walk(fullPath);
47
- } else {
48
- if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
49
- if (cb)
50
- cb(fullPath);
51
- }
52
- }
53
- });
54
- });
55
- });
56
- } catch (error) {
57
- console.log("error", error);
58
- }
59
- };
60
- walk(base);
61
- };
62
- var findFileByExt = forEachFileByExt;
63
- var fileExt = { findFileByExt, forEachFileByExt };
64
- var findFilesByExt_default = fileExt;
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- findFileByExt,
68
- forEachFileByExt
69
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findFileByExt = exports.forEachFileByExt = void 0;
4
+ var path = require("path");
5
+ var fs = require("fs");
6
+ /**
7
+ * This is an alias of "findFileByExt()"
8
+ */
9
+ const forEachFileByExt = (base, ext, cb) => {
10
+ var walk = function (directoryName) {
11
+ try {
12
+ fs.readdir(directoryName, function (e, files) {
13
+ if (e) {
14
+ console.log("Error: ", e);
15
+ return;
16
+ }
17
+ files.forEach(function (file) {
18
+ var fullPath = path.join(directoryName, file);
19
+ fs.stat(fullPath, function (e, f) {
20
+ if (e) {
21
+ console.log("Error: ", e);
22
+ return;
23
+ }
24
+ if (f.isDirectory()) {
25
+ walk(fullPath);
26
+ }
27
+ else {
28
+ if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
29
+ if (cb)
30
+ cb(fullPath);
31
+ }
32
+ }
33
+ });
34
+ });
35
+ });
36
+ }
37
+ catch (error) {
38
+ console.log("error", error);
39
+ }
40
+ };
41
+ walk(base);
42
+ };
43
+ exports.forEachFileByExt = forEachFileByExt;
44
+ /**
45
+ * This is an alias of "forEachFileByExt()"
46
+ */
47
+ exports.findFileByExt = exports.forEachFileByExt;
48
+ const fileExt = { findFileByExt: exports.findFileByExt, forEachFileByExt: exports.forEachFileByExt };
49
+ exports.default = fileExt;
50
+ //# sourceMappingURL=findFilesByExt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findFilesByExt.js","sourceRoot":"","sources":["../../src/file/findFilesByExt.ts"],"names":[],"mappings":";;;AAAA,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,EAAwB,EAAE,EAAE;IACvF,IAAI,IAAI,GAAG,UAAU,aAAqB;QACzC,IAAI;YACH,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAM,EAAE,KAAe;gBAC1D,IAAI,CAAC,EAAE;oBACN,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;oBAC1B,OAAO;iBACP;gBACD,KAAK,CAAC,OAAO,CAAC,UAAU,IAAY;oBACnC,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;oBAC9C,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAM,EAAE,CAAM;wBACzC,IAAI,CAAC,EAAE;4BACN,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;4BAC1B,OAAO;yBACP;wBACD,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;4BACpB,IAAI,CAAC,QAAQ,CAAC,CAAC;yBACf;6BAAM;4BACN,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;gCAC3D,IAAI,EAAE;oCAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;6BACrB;yBACD;oBACF,CAAC,CAAC,CAAC;gBACJ,CAAC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC5B;IACF,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACZ,CAAC,CAAC;AA9BW,QAAA,gBAAgB,oBA8B3B;AAEF;;GAEG;AACU,QAAA,aAAa,GAAG,wBAAgB,CAAC;AAE9C,MAAM,OAAO,GAAG,EAAE,aAAa,EAAb,qBAAa,EAAE,gBAAgB,EAAhB,wBAAgB,EAAE,CAAC;AAEpD,kBAAe,OAAO,CAAC"}
@@ -1,11 +1,9 @@
1
- import { a as createDir } from '../createDir-220e0081.js';
2
- import { a as fileMove } from '../fileMove-3a09e429.js';
3
-
1
+ import { createDir } from "./createDir";
2
+ import { fileMove } from "./fileMove";
4
3
  declare const xfile: {
5
4
  findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
6
5
  forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
7
6
  createDir: typeof createDir;
8
7
  fileMove: typeof fileMove;
9
- };
10
-
11
- export { xfile as default };
8
+ };
9
+ export default xfile;
@@ -1,106 +1,11 @@
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/file/index.ts
21
- var file_exports = {};
22
- __export(file_exports, {
23
- default: () => file_default
24
- });
25
- module.exports = __toCommonJS(file_exports);
26
-
27
- // src/file/createDir.ts
28
- var fs = require("fs");
29
- function createDir(path2) {
30
- if (fs.existsSync(path2)) {
31
- console.log("directory already exited !");
32
- return true;
33
- }
34
- fs.mkdirSync(path2, { recursive: true });
35
- }
36
-
37
- // src/file/fileMove.ts
38
- var fs2 = require("fs");
39
- function fileMove(oldPath, newPath, callback) {
40
- fs2.rename(oldPath, newPath, function(err) {
41
- if (err) {
42
- if (err.code === "EXDEV") {
43
- copy();
44
- } else {
45
- callback(err);
46
- }
47
- return;
48
- }
49
- callback();
50
- });
51
- function copy() {
52
- var readStream = fs2.createReadStream(oldPath);
53
- var writeStream = fs2.createWriteStream(newPath);
54
- readStream.on("error", callback);
55
- writeStream.on("error", callback);
56
- readStream.on("close", function() {
57
- fs2.unlink(oldPath, callback);
58
- });
59
- readStream.pipe(writeStream);
60
- }
61
- }
62
-
63
- // src/file/findFilesByExt.ts
64
- var path = require("path");
65
- var fs3 = require("fs");
66
- var forEachFileByExt = (base, ext, cb) => {
67
- var walk = function(directoryName) {
68
- try {
69
- fs3.readdir(directoryName, function(e, files) {
70
- if (e) {
71
- console.log("Error: ", e);
72
- return;
73
- }
74
- files.forEach(function(file) {
75
- var fullPath = path.join(directoryName, file);
76
- fs3.stat(fullPath, function(e2, f) {
77
- if (e2) {
78
- console.log("Error: ", e2);
79
- return;
80
- }
81
- if (f.isDirectory()) {
82
- walk(fullPath);
83
- } else {
84
- if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
85
- if (cb)
86
- cb(fullPath);
87
- }
88
- }
89
- });
90
- });
91
- });
92
- } catch (error) {
93
- console.log("error", error);
94
- }
95
- };
96
- walk(base);
97
- };
98
- var findFileByExt = forEachFileByExt;
99
- var fileExt = { findFileByExt, forEachFileByExt };
100
- var findFilesByExt_default = fileExt;
101
-
102
- // src/file/index.ts
103
- var xfile = { createDir, fileMove, ...findFilesByExt_default };
104
- var file_default = xfile;
105
- // Annotate the CommonJS export names for ESM import in node:
106
- 0 && (module.exports = {});
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const createDir_1 = require("./createDir");
7
+ const fileMove_1 = require("./fileMove");
8
+ const findFilesByExt_1 = __importDefault(require("./findFilesByExt"));
9
+ const xfile = { createDir: createDir_1.createDir, fileMove: fileMove_1.fileMove, ...findFilesByExt_1.default };
10
+ exports.default = xfile;
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":";;;;;AAAA,2CAAwC;AACxC,yCAAsC;AACtC,sEAAuC;AAEvC,MAAM,KAAK,GAAG,EAAE,SAAS,EAAT,qBAAS,EAAE,QAAQ,EAAR,mBAAQ,EAAE,GAAG,wBAAO,EAAE,CAAC;AAElD,kBAAe,KAAK,CAAC"}
@@ -1,2 +1,2 @@
1
- export { default as upload } from './upload.js';
2
- export { default as resize } from './resize.js';
1
+ export { upload } from "./upload";
2
+ export { resize } from "./resize";
@@ -1,132 +1,9 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
-
26
- // src/images/index.ts
27
- var images_exports = {};
28
- __export(images_exports, {
29
- resize: () => resize,
30
- upload: () => upload
31
- });
32
- module.exports = __toCommonJS(images_exports);
33
-
34
- // src/response/index.ts
35
- var getFailedResponse = (...messages) => {
36
- if (!messages)
37
- messages = ["What's do you want?"];
38
- return { status: 0, error: true, messages: [...messages], data: {} };
39
- };
40
-
41
- // src/images/resize.ts
42
- var import_blueimp_load_image = __toESM(require("blueimp-load-image"));
43
- var resize = async (file) => {
44
- if (!file) {
45
- console.error("NO FILE AVAIABLE!");
46
- return;
47
- }
48
- const { type } = file;
49
- const data = await (0, import_blueimp_load_image.default)(file, {
50
- meta: false,
51
- canvas: true,
52
- maxWidth: 2048,
53
- maxHeight: 2048
54
- });
55
- const blob = await new Promise(function(resolve) {
56
- try {
57
- const canvas = data.image;
58
- canvas.toBlob(function(blob2) {
59
- resolve(blob2);
60
- }, type);
61
- } catch (error) {
62
- console.error(`diginext-utils/src/images/resize.ts canvas.toBlob error`, error);
63
- }
64
- });
65
- if (blob)
66
- return blob;
67
- return data;
68
- };
69
- var resize_default = resize;
70
-
71
- // src/object.ts
72
- var isNull = (object) => {
73
- if (typeof object == "undefined")
74
- return true;
75
- if (object == "")
76
- return true;
77
- if (Array.isArray(object))
78
- return object.length == 0;
79
- if (JSON.stringify(object) == "{}")
80
- return true;
81
- return object == null;
82
- };
83
-
84
- // src/string/url.ts
85
- var getFileNameWithExtension = (url) => {
86
- var _a, _b;
87
- const _url = decodeURIComponent(url);
88
- const m = _url.toString().match(/.*\/(.*)$/) || [];
89
- if (typeof m != "undefined" && (m == null ? void 0 : m.length) > 1) {
90
- const a = ((_a = m == null ? void 0 : m[1].split("/")) == null ? void 0 : _a.pop()) || "";
91
- const b = (_b = a.split("?")) == null ? void 0 : _b.shift();
92
- return b || (m == null ? void 0 : m[1]) || "";
93
- }
94
- if (!isNull(_url))
95
- return url;
96
- return "";
97
- };
98
- var getFileExtension = (url) => {
99
- return getFileNameWithExtension(url).split(".").pop();
100
- };
101
- var isImage = (url) => {
102
- if (!url)
103
- return false;
104
- const arr = ["png", "jpg", "jpeg", "jpe", "jif", "jfif", "gif", "svg"];
105
- const index = arr.findIndex((item) => {
106
- var _a;
107
- return ((_a = getFileExtension(url)) == null ? void 0 : _a.toLowerCase()) == item;
108
- });
109
- return index >= 0;
110
- };
111
-
112
- // src/images/upload.ts
113
- var upload = async (file) => {
114
- const { name } = file;
115
- if (!isImage(name)) {
116
- const err = "Please Choose Image!";
117
- console.error(err);
118
- return getFailedResponse(err);
119
- }
120
- const blob = await resize_default(file);
121
- const url = URL.createObjectURL(blob);
122
- blob.name = name;
123
- return {
124
- blob,
125
- url
126
- };
127
- };
128
- // Annotate the CommonJS export names for ESM import in node:
129
- 0 && (module.exports = {
130
- resize,
131
- upload
132
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resize = exports.upload = void 0;
4
+ // export { default as AdminIcon } from "diginext-dashkit/dist/Icon";
5
+ var upload_1 = require("./upload");
6
+ Object.defineProperty(exports, "upload", { enumerable: true, get: function () { return upload_1.upload; } });
7
+ var resize_1 = require("./resize");
8
+ Object.defineProperty(exports, "resize", { enumerable: true, get: function () { return resize_1.resize; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/images/index.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
@@ -1,3 +1 @@
1
- declare function loadImage(list: Array<string>): Promise<unknown[] | undefined>;
2
-
3
- export { loadImage as default };
1
+ export default function loadImage(list: Array<string>): Promise<unknown[] | undefined>;
@@ -1,42 +1,18 @@
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/images/loadImage.ts
21
- var loadImage_exports = {};
22
- __export(loadImage_exports, {
23
- default: () => loadImage
24
- });
25
- module.exports = __toCommonJS(loadImage_exports);
26
- async function loadImage(list) {
27
- if (!(list == null ? void 0 : list.length))
28
- return;
29
- return await Promise.all(
30
- list.map((url) => {
31
- return new Promise((resolve, reject) => {
32
- const img = new Image();
33
- img.onload = resolve;
34
- img.onerror = reject;
35
- img.src = url;
36
- return;
37
- });
38
- })
39
- );
40
- }
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ async function loadImage(list) {
4
+ //
5
+ if (!(list === null || list === void 0 ? void 0 : list.length))
6
+ return;
7
+ return await Promise.all(list.map((url) => {
8
+ return new Promise((resolve, reject) => {
9
+ const img = new Image();
10
+ img.onload = resolve;
11
+ img.onerror = reject;
12
+ img.src = url;
13
+ return;
14
+ });
15
+ }));
16
+ }
17
+ exports.default = loadImage;
18
+ //# sourceMappingURL=loadImage.js.map