diginext-utils 2.0.3 → 2.0.5

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 (101) hide show
  1. package/dist/.DS_Store +0 -0
  2. package/dist/Checker.js +26 -5
  3. package/dist/Checker.mjs +4 -3
  4. package/dist/EventDispatcher.d.ts +1 -1
  5. package/dist/EventDispatcher.js +26 -3
  6. package/dist/EventDispatcher.mjs +4 -3
  7. package/dist/FileUpload.d.ts +1 -1
  8. package/dist/FileUpload.js +26 -4
  9. package/dist/FileUpload.mjs +4 -4
  10. package/dist/Slug.js +26 -5
  11. package/dist/Slug.mjs +4 -3
  12. package/dist/Timer.d.ts +1 -1
  13. package/dist/Timer.js +26 -4
  14. package/dist/Timer.mjs +7 -2
  15. package/dist/Validation.d.ts +2 -2
  16. package/dist/Validation.js +27 -4
  17. package/dist/Validation.mjs +5 -4
  18. package/dist/array.js +66 -23
  19. package/dist/array.mjs +44 -3
  20. package/dist/{chunk-JKYSZLBF.mjs → chunk-2R5DRG2S.mjs} +3 -2
  21. package/dist/{chunk-7IYY7BKN.mjs → chunk-3NMJTC44.mjs} +13 -3
  22. package/dist/chunk-5AL36RZR.mjs +8 -1
  23. package/dist/chunk-7UXN7I4K.mjs +13 -2
  24. package/dist/chunk-A4YWYLCH.mjs +23 -0
  25. package/dist/chunk-AHFJBIQJ.mjs +4 -3
  26. package/dist/chunk-AKU6F3WT.mjs +3 -1
  27. package/dist/chunk-ALNAD4H7.mjs +10 -0
  28. package/dist/chunk-FOWYH6LL.mjs +7 -1
  29. package/dist/chunk-FTE6FZSH.mjs +8 -1
  30. package/dist/chunk-LXQIKFED.mjs +5 -1
  31. package/dist/{chunk-VZGV2BTL.mjs → chunk-NLQXFCPR.mjs} +6 -3
  32. package/dist/{chunk-VFKAZAWF.mjs → chunk-QXFH3X2K.mjs} +11 -2
  33. package/dist/{chunk-Q5R25OIS.mjs → chunk-S2U7F2JJ.mjs} +24 -2
  34. package/dist/chunk-UKRVCU5M.mjs +6 -1
  35. package/dist/color.js +36 -10
  36. package/dist/color.mjs +9 -3
  37. package/dist/console/enableConsole.d.ts +1 -1
  38. package/dist/console/enableConsole.js +34 -10
  39. package/dist/console/enableConsole.mjs +11 -2
  40. package/dist/console/index.js +30 -7
  41. package/dist/console/index.mjs +18 -2
  42. package/dist/device/browser.js +34 -9
  43. package/dist/device/browser.mjs +39 -2
  44. package/dist/device/camera.js +34 -6
  45. package/dist/device/camera.mjs +146 -3
  46. package/dist/device.js +32 -8
  47. package/dist/device.mjs +13 -2
  48. package/dist/file/createDir.d.ts +1 -1
  49. package/dist/file/createDir.js +27 -12
  50. package/dist/file/createDir.mjs +6 -3
  51. package/dist/file/fileMove.d.ts +1 -1
  52. package/dist/file/fileMove.js +27 -12
  53. package/dist/file/fileMove.mjs +6 -3
  54. package/dist/file/findFilesByExt.d.ts +1 -1
  55. package/dist/file/findFilesByExt.js +28 -14
  56. package/dist/file/findFilesByExt.mjs +6 -4
  57. package/dist/index.d.ts +5 -5
  58. package/dist/index.js +159 -73
  59. package/dist/index.mjs +143 -13
  60. package/dist/math/diffDate.d.ts +1 -1
  61. package/dist/math/diffDate.js +26 -3
  62. package/dist/math/diffDate.mjs +4 -3
  63. package/dist/{math.d.ts → math/index.d.ts} +0 -0
  64. package/dist/math/index.js +79 -0
  65. package/dist/math/index.mjs +21 -0
  66. package/dist/math/positiveNumber.d.ts +1 -1
  67. package/dist/math/positiveNumber.js +28 -3
  68. package/dist/math/positiveNumber.mjs +7 -4
  69. package/dist/name/en.js +26 -5
  70. package/dist/name/en.mjs +4 -3
  71. package/dist/name/vi.js +30 -5
  72. package/dist/name/vi.mjs +19 -5
  73. package/dist/object.js +36 -10
  74. package/dist/object.mjs +17 -2
  75. package/dist/permission/requestCamera.d.ts +1 -1
  76. package/dist/permission/requestCamera.js +26 -4
  77. package/dist/permission/requestCamera.mjs +7 -2
  78. package/dist/permission/requestDeviceOrientationControl.d.ts +1 -1
  79. package/dist/permission/requestDeviceOrientationControl.js +28 -4
  80. package/dist/permission/requestDeviceOrientationControl.mjs +176 -3
  81. package/dist/string/formatNumber.d.ts +1 -1
  82. package/dist/string/formatNumber.js +28 -3
  83. package/dist/string/formatNumber.mjs +7 -4
  84. package/dist/string/generatePassword.d.ts +1 -1
  85. package/dist/string/generatePassword.js +28 -3
  86. package/dist/string/generatePassword.mjs +10 -4
  87. package/dist/string/generateUUID.d.ts +1 -1
  88. package/dist/string/generateUUID.js +26 -3
  89. package/dist/string/generateUUID.mjs +4 -3
  90. package/dist/string/index.js +41 -11
  91. package/dist/string/index.mjs +96 -3
  92. package/dist/string/random.js +36 -10
  93. package/dist/string/random.mjs +17 -2
  94. package/dist/string/trimNull.d.ts +1 -1
  95. package/dist/string/trimNull.js +34 -10
  96. package/dist/string/trimNull.mjs +6 -4
  97. package/dist/string/url.js +40 -10
  98. package/dist/string/url.mjs +14 -4
  99. package/package.json +7 -8
  100. package/dist/math.js +0 -51
  101. package/dist/math.mjs +0 -2
@@ -1,4 +1,27 @@
1
- 'use strict';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/string/generatePassword.ts
20
+ var generatePassword_exports = {};
21
+ __export(generatePassword_exports, {
22
+ generatePassword: () => generatePassword
23
+ });
24
+ module.exports = __toCommonJS(generatePassword_exports);
2
25
 
3
26
  // src/string/random.ts
4
27
  var textLowCase = "abcdefghijklmnopqrstuvwxyz";
@@ -23,5 +46,7 @@ function generatePassword(length = 6, hard = true) {
23
46
  pass = pass.replace(pass[Math.floor(pass.length / 2)], randomStringByLength(1, punctuation));
24
47
  return pass;
25
48
  }
26
-
27
- module.exports = generatePassword;
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ generatePassword
52
+ });
@@ -1,5 +1,10 @@
1
- import { randomStringByLength, textLowCase, numeric, punctuation } from '../chunk-FTE6FZSH.mjs';
2
- import '../chunk-AKU6F3WT.mjs';
1
+ import {
2
+ numeric,
3
+ punctuation,
4
+ randomStringByLength,
5
+ textLowCase
6
+ } from "../chunk-FTE6FZSH.mjs";
7
+ import "../chunk-AKU6F3WT.mjs";
3
8
 
4
9
  // src/string/generatePassword.ts
5
10
  function generatePassword(length = 6, hard = true) {
@@ -12,5 +17,6 @@ function generatePassword(length = 6, hard = true) {
12
17
  pass = pass.replace(pass[Math.floor(pass.length / 2)], randomStringByLength(1, punctuation));
13
18
  return pass;
14
19
  }
15
-
16
- export { generatePassword as default };
20
+ export {
21
+ generatePassword
22
+ };
@@ -1,3 +1,3 @@
1
1
  declare function generateUUID(): string;
2
2
 
3
- export { generateUUID as default };
3
+ export { generateUUID };
@@ -1,6 +1,27 @@
1
- 'use strict';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
18
 
3
19
  // src/string/generateUUID.ts
20
+ var generateUUID_exports = {};
21
+ __export(generateUUID_exports, {
22
+ generateUUID: () => generateUUID
23
+ });
24
+ module.exports = __toCommonJS(generateUUID_exports);
4
25
  var _lut = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
5
26
  function generateUUID() {
6
27
  const d0 = Math.random() * 4294967295 | 0;
@@ -10,5 +31,7 @@ function generateUUID() {
10
31
  const uuid = _lut[d0 & 255] + _lut[d0 >> 8 & 255] + _lut[d0 >> 16 & 255] + _lut[d0 >> 24 & 255] + "-" + _lut[d1 & 255] + _lut[d1 >> 8 & 255] + "-" + _lut[d1 >> 16 & 15 | 64] + _lut[d1 >> 24 & 255] + "-" + _lut[d2 & 63 | 128] + _lut[d2 >> 8 & 255] + "-" + _lut[d2 >> 16 & 255] + _lut[d2 >> 24 & 255] + _lut[d3 & 255] + _lut[d3 >> 8 & 255] + _lut[d3 >> 16 & 255] + _lut[d3 >> 24 & 255];
11
32
  return uuid.toLowerCase();
12
33
  }
13
-
14
- module.exports = generateUUID;
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ generateUUID
37
+ });
@@ -1,4 +1,4 @@
1
- import '../chunk-AKU6F3WT.mjs';
1
+ import "../chunk-AKU6F3WT.mjs";
2
2
 
3
3
  // src/string/generateUUID.ts
4
4
  var _lut = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
@@ -10,5 +10,6 @@ function generateUUID() {
10
10
  const uuid = _lut[d0 & 255] + _lut[d0 >> 8 & 255] + _lut[d0 >> 16 & 255] + _lut[d0 >> 24 & 255] + "-" + _lut[d1 & 255] + _lut[d1 >> 8 & 255] + "-" + _lut[d1 >> 16 & 15 | 64] + _lut[d1 >> 24 & 255] + "-" + _lut[d2 & 63 | 128] + _lut[d2 >> 8 & 255] + "-" + _lut[d2 >> 16 & 255] + _lut[d2 >> 24 & 255] + _lut[d3 & 255] + _lut[d3 >> 8 & 255] + _lut[d3 >> 16 & 255] + _lut[d3 >> 24 & 255];
11
11
  return uuid.toLowerCase();
12
12
  }
13
-
14
- export { generateUUID as default };
13
+ export {
14
+ generateUUID
15
+ };
@@ -1,6 +1,34 @@
1
- 'use strict';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
18
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
19
+ // src/string/index.ts
20
+ var string_exports = {};
21
+ __export(string_exports, {
22
+ capitalize: () => capitalize,
23
+ capitalizeName: () => capitalizeName,
24
+ clearUnicodeCharacters: () => clearUnicodeCharacters,
25
+ getBetween: () => getBetween,
26
+ makeString: () => makeString,
27
+ titleize: () => titleize,
28
+ toLowerCase: () => toLowerCase,
29
+ toUpperCase: () => toUpperCase
30
+ });
31
+ module.exports = __toCommonJS(string_exports);
4
32
 
5
33
  // src/object.ts
6
34
  var isNull = (object) => {
@@ -96,12 +124,14 @@ var clearUnicodeCharacters = (s, opt = {}) => {
96
124
  s = s.replace(RegExp("(^" + opt.delimiter + "|" + opt.delimiter + "$)", "g"), "");
97
125
  return opt.lowercase ? s.toLowerCase() : s;
98
126
  };
99
-
100
- exports.capitalize = capitalize;
101
- exports.capitalizeName = capitalizeName;
102
- exports.clearUnicodeCharacters = clearUnicodeCharacters;
103
- exports.getBetween = getBetween;
104
- exports.makeString = makeString;
105
- exports.titleize = titleize;
106
- exports.toLowerCase = toLowerCase;
107
- exports.toUpperCase = toUpperCase;
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ capitalize,
130
+ capitalizeName,
131
+ clearUnicodeCharacters,
132
+ getBetween,
133
+ makeString,
134
+ titleize,
135
+ toLowerCase,
136
+ toUpperCase
137
+ });
@@ -1,3 +1,96 @@
1
- export { capitalize, capitalizeName, clearUnicodeCharacters, getBetween, makeString, titleize, toLowerCase, toUpperCase } from '../chunk-7UXN7I4K.mjs';
2
- import '../chunk-5AL36RZR.mjs';
3
- import '../chunk-AKU6F3WT.mjs';
1
+ import {
2
+ isNull
3
+ } from "../chunk-A4YWYLCH.mjs";
4
+ import "../chunk-AKU6F3WT.mjs";
5
+
6
+ // src/string/index.ts
7
+ var char_map = { \u00C0: "A", \u00C1: "A", \u00C2: "A", \u00C3: "A", \u00C4: "A", \u00C5: "A", \u00C6: "AE", \u00C7: "C", \u00C8: "E", \u00C9: "E", \u00CA: "E", \u00CB: "E", \u00CC: "I", \u00CD: "I", \u00CE: "I", \u00CF: "I", \u00D0: "D", \u00D1: "N", \u00D2: "O", \u00D3: "O", \u00D4: "O", \u00D5: "O", \u00D6: "O", \u0150: "O", \u00D8: "O", \u00D9: "U", \u00DA: "U", \u00DB: "U", \u0170: "U", \u00DD: "Y", \u00DE: "TH", \u00DF: "ss", \u00E0: "a", \u00E1: "a", \u00E2: "a", \u00E3: "a", \u00E4: "a", \u00E5: "a", \u00E6: "ae", \u00E8: "e", \u00E9: "e", \u00EA: "e", \u00EB: "e", \u00EC: "i", \u00ED: "i", \u00EE: "i", \u00EF: "i", \u00F0: "d", \u00F1: "n", \u00F2: "o", \u00F3: "o", \u00F4: "o", \u00F5: "o", \u00F6: "o", \u0151: "o", \u00F8: "o", \u00F9: "u", \u00FA: "u", \u00FB: "u", \u0171: "u", \u00FD: "y", \u00FE: "th", \u00FF: "y", "\xA9": "(c)", \u0393: "G", \u0394: "D", \u0398: "8", \u039B: "L", \u039E: "3", \u03A0: "P", \u03A3: "S", \u03A6: "F", \u03A8: "PS", \u03A9: "W", \u0386: "A", \u0388: "E", \u038A: "I", \u038C: "O", \u038E: "Y", \u0389: "H", \u038F: "W", \u03AA: "I", \u03AB: "Y", \u03B2: "b", "\u03B3": "y", \u03B4: "d", \u03B5: "e", \u03B6: "z", \u03B7: "h", \u03B8: "8", \u03B9: "i", \u03BA: "k", \u03BB: "l", \u03BC: "m", \u03BD: "n", \u03BE: "3", \u03BF: "o", \u03C0: "p", \u03C1: "r", \u03C3: "s", \u03C4: "t", \u03C5: "y", \u03C6: "f", \u03C7: "x", \u03C8: "ps", \u03C9: "w", \u03AC: "a", \u03AD: "e", \u03AF: "i", \u03CC: "o", \u03CD: "y", \u03AE: "h", \u03CE: "w", \u03C2: "s", \u03CA: "i", \u03B0: "y", \u03CB: "y", \u0390: "i", \u015E: "S", \u0130: "I", \u00DC: "U", \u011E: "G", \u015F: "s", \u0131: "i", \u00E7: "c", \u00FC: "u", \u011F: "g", \u0410: "A", \u0411: "B", \u0412: "V", \u0413: "G", \u0414: "D", \u0415: "E", \u0401: "Yo", \u0416: "Zh", \u0417: "Z", \u0418: "I", \u0419: "J", \u041A: "K", \u041B: "L", \u041C: "M", \u041D: "N", \u041E: "O", \u041F: "P", \u0420: "R", \u0421: "S", \u0422: "T", \u0423: "U", \u0424: "F", \u0425: "H", \u0426: "C", \u0427: "Ch", \u0428: "Sh", \u0429: "Sh", \u042A: "", \u042B: "Y", \u042C: "", \u042D: "E", \u042E: "Yu", \u042F: "Ya", \u0430: "a", \u0431: "b", \u0432: "v", \u0433: "g", \u0434: "d", \u0435: "e", \u0451: "yo", \u0436: "zh", \u0437: "z", \u0438: "i", \u0439: "j", \u043A: "k", \u043B: "l", \u043C: "m", \u043D: "n", \u043E: "o", \u043F: "p", \u0440: "r", \u0441: "s", \u0442: "t", \u0443: "u", \u0444: "f", \u0445: "h", \u0446: "c", \u0447: "ch", \u0448: "sh", \u0449: "sh", \u044A: "", \u044B: "y", \u044C: "", \u044D: "e", \u044E: "yu", \u044F: "ya", \u0404: "Ye", \u0406: "I", \u0407: "Yi", \u0490: "G", \u0454: "ye", \u0456: "i", \u0457: "yi", \u0491: "g", \u010C: "C", \u010E: "D", \u011A: "E", \u0147: "N", \u0158: "R", \u0160: "S", \u0164: "T", \u016E: "U", \u017D: "Z", \u010D: "c", \u010F: "d", \u011B: "e", \u0148: "n", \u0159: "r", \u0161: "s", \u0165: "t", \u016F: "u", \u017E: "z", \u0104: "A", \u0106: "C", \u0118: "e", \u0141: "L", \u0143: "N", \u015A: "S", \u0179: "Z", \u017B: "Z", \u0105: "a", \u0107: "c", \u0119: "e", \u0142: "l", \u0144: "n", \u015B: "s", \u017A: "z", \u017C: "z", \u0100: "A", \u0112: "E", \u0122: "G", \u012A: "i", \u0136: "k", \u013B: "L", \u0145: "N", \u016A: "u", \u0101: "a", \u0113: "e", \u0123: "g", \u012B: "i", \u0137: "k", \u013C: "l", \u0146: "n", \u016B: "u" };
8
+ var getBetween = (text, str1, str2 = "") => {
9
+ if (!text)
10
+ return "";
11
+ if (text.indexOf(str1) <= -1)
12
+ return "";
13
+ const firstIndex = text.indexOf(str1) + str1.length;
14
+ const secondIndex = str2 ? text.indexOf(str2, firstIndex) : text.length;
15
+ return text.substring(firstIndex, secondIndex);
16
+ };
17
+ var makeString = (object = "") => {
18
+ if (isNull(object))
19
+ return "";
20
+ return "" + object;
21
+ };
22
+ var toUpperCase = (str = "") => {
23
+ return makeString(str).toUpperCase();
24
+ };
25
+ var toLowerCase = (str = "") => {
26
+ return makeString(str).toLowerCase();
27
+ };
28
+ var titleize = (str = "") => {
29
+ const regString = new RegExp(/(?:^|\s|-)\S/g);
30
+ return toLowerCase(str).replace(regString, function(c) {
31
+ return c.toUpperCase();
32
+ });
33
+ };
34
+ var capitalize = (str, lowercaseRest = 1) => {
35
+ str = makeString(str);
36
+ const remainingChars = !lowercaseRest ? str.slice(1) : str.slice(1).toLowerCase();
37
+ return str.charAt(0).toUpperCase() + remainingChars;
38
+ };
39
+ var capitalizeName = (str) => {
40
+ str = makeString(str);
41
+ str = str.trim();
42
+ str = str.replace(/^\s+|\s+$/gm, "");
43
+ str = str.toLowerCase();
44
+ const arr = str.split(" ");
45
+ str = arr.map((item) => {
46
+ return capitalize(item);
47
+ }).filter((x) => x).join(" ");
48
+ return str;
49
+ };
50
+ var clearUnicodeCharacters = (s, opt = {}) => {
51
+ s = makeString(s);
52
+ var defaults = {
53
+ delimiter: " ",
54
+ lowercase: true,
55
+ replacements: {},
56
+ transliterate: typeof XRegExp === "undefined" ? true : false
57
+ };
58
+ for (var k in defaults) {
59
+ if (!opt.hasOwnProperty(k)) {
60
+ opt[k] = defaults[k];
61
+ }
62
+ }
63
+ s = s.replace(/á|à|ả|ạ|ã|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ/gi, "a");
64
+ s = s.replace(/é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ/gi, "e");
65
+ s = s.replace(/i|í|ì|ỉ|ĩ|ị/gi, "i");
66
+ s = s.replace(/ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ/gi, "o");
67
+ s = s.replace(/ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự/gi, "u");
68
+ s = s.replace(/ý|ỳ|ỷ|ỹ|ỵ/gi, "y");
69
+ s = s.replace(/đ/gi, "d");
70
+ s = "@" + s + "@";
71
+ s = s.replace(/\@\-|\-\@|\@/gi, "");
72
+ for (var k in opt.replacements) {
73
+ s = s.replace(RegExp(k, "g"), opt.replacements[k]);
74
+ }
75
+ if (opt.transliterate) {
76
+ for (var k in char_map) {
77
+ s = s.replace(RegExp(k, "g"), char_map[k]);
78
+ }
79
+ }
80
+ var alnum = typeof XRegExp === "undefined" ? RegExp("[^a-z0-9]+", "ig") : XRegExp("[^\\p{L}\\p{N}]+", "ig");
81
+ s = s.replace(alnum, opt.delimiter);
82
+ s = s.replace(RegExp("[" + opt.delimiter + "]{2,}", "g"), opt.delimiter);
83
+ s = s.substring(0, opt.limit);
84
+ s = s.replace(RegExp("(^" + opt.delimiter + "|" + opt.delimiter + "$)", "g"), "");
85
+ return opt.lowercase ? s.toLowerCase() : s;
86
+ };
87
+ export {
88
+ capitalize,
89
+ capitalizeName,
90
+ clearUnicodeCharacters,
91
+ getBetween,
92
+ makeString,
93
+ titleize,
94
+ toLowerCase,
95
+ toUpperCase
96
+ };
@@ -1,8 +1,32 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
4
18
 
5
19
  // src/string/random.ts
20
+ var random_exports = {};
21
+ __export(random_exports, {
22
+ allCharacter: () => allCharacter,
23
+ numeric: () => numeric,
24
+ punctuation: () => punctuation,
25
+ randAllCharacterByLength: () => randAllCharacterByLength,
26
+ randomStringByLength: () => randomStringByLength,
27
+ textLowCase: () => textLowCase
28
+ });
29
+ module.exports = __toCommonJS(random_exports);
6
30
  var textLowCase = "abcdefghijklmnopqrstuvwxyz";
7
31
  var numeric = "0123456789";
8
32
  var punctuation = "!@#$%^&*()_+~|}{[];?><,./-=";
@@ -17,10 +41,12 @@ var randomStringByLength = (length, str = textLowCase) => {
17
41
  }
18
42
  return result;
19
43
  };
20
-
21
- exports.allCharacter = allCharacter;
22
- exports.numeric = numeric;
23
- exports.punctuation = punctuation;
24
- exports.randAllCharacterByLength = randAllCharacterByLength;
25
- exports.randomStringByLength = randomStringByLength;
26
- exports.textLowCase = textLowCase;
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ allCharacter,
47
+ numeric,
48
+ punctuation,
49
+ randAllCharacterByLength,
50
+ randomStringByLength,
51
+ textLowCase
52
+ });
@@ -1,2 +1,17 @@
1
- export { allCharacter, numeric, punctuation, randAllCharacterByLength, randomStringByLength, textLowCase } from '../chunk-FTE6FZSH.mjs';
2
- import '../chunk-AKU6F3WT.mjs';
1
+ import {
2
+ allCharacter,
3
+ numeric,
4
+ punctuation,
5
+ randAllCharacterByLength,
6
+ randomStringByLength,
7
+ textLowCase
8
+ } from "../chunk-FTE6FZSH.mjs";
9
+ import "../chunk-AKU6F3WT.mjs";
10
+ export {
11
+ allCharacter,
12
+ numeric,
13
+ punctuation,
14
+ randAllCharacterByLength,
15
+ randomStringByLength,
16
+ textLowCase
17
+ };
@@ -1,3 +1,3 @@
1
1
  declare function trimNull(str: string): string;
2
2
 
3
- export { trimNull as default };
3
+ export { trimNull };
@@ -1,20 +1,44 @@
1
- 'use strict';
2
-
3
- var trim = require('lodash/trim');
4
-
5
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
-
7
- var trim__default = /*#__PURE__*/_interopDefaultLegacy(trim);
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
8
24
 
9
25
  // src/string/trimNull.ts
26
+ var trimNull_exports = {};
27
+ __export(trimNull_exports, {
28
+ trimNull: () => trimNull
29
+ });
30
+ module.exports = __toCommonJS(trimNull_exports);
31
+ var import_trim = __toESM(require("lodash/trim"));
10
32
  function trimNull(str) {
11
33
  if (!str)
12
34
  return "";
13
35
  str = str.toString();
14
36
  str = str.replace(/\0/g, "");
15
37
  str = str.replaceAll(" ", "");
16
- str = trim__default["default"](str);
38
+ str = (0, import_trim.default)(str);
17
39
  return str;
18
40
  }
19
-
20
- module.exports = trimNull;
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ trimNull
44
+ });
@@ -1,6 +1,7 @@
1
- import '../chunk-AKU6F3WT.mjs';
2
- import trim from 'lodash/trim';
1
+ import "../chunk-AKU6F3WT.mjs";
3
2
 
3
+ // src/string/trimNull.ts
4
+ import trim from "lodash/trim";
4
5
  function trimNull(str) {
5
6
  if (!str)
6
7
  return "";
@@ -10,5 +11,6 @@ function trimNull(str) {
10
11
  str = trim(str);
11
12
  return str;
12
13
  }
13
-
14
- export { trimNull as default };
14
+ export {
15
+ trimNull
16
+ };
@@ -1,6 +1,33 @@
1
- 'use strict';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
18
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
19
+ // src/string/url.ts
20
+ var url_exports = {};
21
+ __export(url_exports, {
22
+ addQueryParam: () => addQueryParam,
23
+ getFileExtension: () => getFileExtension,
24
+ getFileNameWithExtension: () => getFileNameWithExtension,
25
+ getFileNameWithoutExtension: () => getFileNameWithoutExtension,
26
+ getUrlParams: () => getUrlParams,
27
+ isImage: () => isImage,
28
+ isLink: () => isLink
29
+ });
30
+ module.exports = __toCommonJS(url_exports);
4
31
 
5
32
  // src/object.ts
6
33
  var isNull = (object) => {
@@ -33,6 +60,7 @@ var getUrlParams = (parameter, staticURL, decode = true) => {
33
60
  var parr = parArr[i].split("=");
34
61
  if (parr[0] == parameter) {
35
62
  return decode ? decodeURIComponent(parr[1]) : parr[1];
63
+ returnBool = true;
36
64
  } else {
37
65
  returnBool = false;
38
66
  }
@@ -79,11 +107,13 @@ var isImage = (url) => {
79
107
  });
80
108
  return index >= 0;
81
109
  };
82
-
83
- exports.addQueryParam = addQueryParam;
84
- exports.getFileExtension = getFileExtension;
85
- exports.getFileNameWithExtension = getFileNameWithExtension;
86
- exports.getFileNameWithoutExtension = getFileNameWithoutExtension;
87
- exports.getUrlParams = getUrlParams;
88
- exports.isImage = isImage;
89
- exports.isLink = isLink;
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ addQueryParam,
113
+ getFileExtension,
114
+ getFileNameWithExtension,
115
+ getFileNameWithoutExtension,
116
+ getUrlParams,
117
+ isImage,
118
+ isLink
119
+ });
@@ -1,5 +1,7 @@
1
- import { isNull } from '../chunk-5AL36RZR.mjs';
2
- import '../chunk-AKU6F3WT.mjs';
1
+ import {
2
+ isNull
3
+ } from "../chunk-A4YWYLCH.mjs";
4
+ import "../chunk-AKU6F3WT.mjs";
3
5
 
4
6
  // src/string/url.ts
5
7
  var urlRegex = /(https?:\/\/[^\s]+)/g;
@@ -19,6 +21,7 @@ var getUrlParams = (parameter, staticURL, decode = true) => {
19
21
  var parr = parArr[i].split("=");
20
22
  if (parr[0] == parameter) {
21
23
  return decode ? decodeURIComponent(parr[1]) : parr[1];
24
+ returnBool = true;
22
25
  } else {
23
26
  returnBool = false;
24
27
  }
@@ -65,5 +68,12 @@ var isImage = (url) => {
65
68
  });
66
69
  return index >= 0;
67
70
  };
68
-
69
- export { addQueryParam, getFileExtension, getFileNameWithExtension, getFileNameWithoutExtension, getUrlParams, isImage, isLink };
71
+ export {
72
+ addQueryParam,
73
+ getFileExtension,
74
+ getFileNameWithExtension,
75
+ getFileNameWithoutExtension,
76
+ getUrlParams,
77
+ isImage,
78
+ isLink
79
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginext-utils",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "sideEffects": false,
5
5
  "author": {
6
6
  "name": "TOP GROUP (a.k.a Digitop)",
@@ -11,15 +11,14 @@
11
11
  "files": [
12
12
  "dist/**"
13
13
  ],
14
- "typesVersions": {
15
- "*": {
16
- "*": ["dist/*.d.ts"]
17
- }
18
- },
14
+ "exports": {
15
+ ".": "./dist",
16
+ "./math": "./dist/math"
17
+ },
19
18
  "scripts": {
20
- "build": "tsup src/**/*.ts --treeshake --format esm,cjs --dts",
19
+ "build": "tsup src/**/*.ts --format esm,cjs --dts",
21
20
  "build2": "tsc src/**/*.ts --emitDeclarationOnly --declaration dist",
22
- "dev": "concurrently \"tsup src/index.ts --treeshake --format esm,cjs --dts --watch",
21
+ "dev": "concurrently \"tsup src/**/*.ts --format esm,cjs --dts --watch\"",
23
22
  "test": "mocha test/*.test.js",
24
23
  "publish": "npm publish",
25
24
  "lint": "TIMING=1 eslint src --fix",
package/dist/math.js DELETED
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- // src/math.ts
6
- var DEG2RAD = Math.PI / 180;
7
- var RAD2DEG = 180 / Math.PI;
8
- var randRound = (number) => {
9
- return Math.round(Math.random() * number);
10
- };
11
- var rand = (number) => {
12
- return (Math.random() - Math.random()) * number;
13
- };
14
- var randHalt = (number) => {
15
- var rand2 = Math.random() - Math.random();
16
- var res;
17
- if (rand2 > 0) {
18
- res = rand2 * (number / 2) + number / 2;
19
- } else {
20
- res = rand2 * (number / 2) - number / 2;
21
- }
22
- return Math.abs(res);
23
- };
24
- var randInt = (low, high) => {
25
- return low + Math.floor(Math.random() * (high - low + 1));
26
- };
27
- var randFloat = (low, high) => {
28
- return low + Math.random() * (high - low);
29
- };
30
- var degToRad = (degrees) => {
31
- return degrees * DEG2RAD;
32
- };
33
- var radToDeg = (radians) => {
34
- return radians * RAD2DEG;
35
- };
36
- var angleBetweenPoints = (cx, cy, ex, ey) => {
37
- var dy = ey - cy;
38
- var dx = ex - cx;
39
- var theta = Math.atan2(dy, dx);
40
- theta *= 180 / Math.PI;
41
- return theta;
42
- };
43
-
44
- exports.angleBetweenPoints = angleBetweenPoints;
45
- exports.degToRad = degToRad;
46
- exports.radToDeg = radToDeg;
47
- exports.rand = rand;
48
- exports.randFloat = randFloat;
49
- exports.randHalt = randHalt;
50
- exports.randInt = randInt;
51
- exports.randRound = randRound;
package/dist/math.mjs DELETED
@@ -1,2 +0,0 @@
1
- export { angleBetweenPoints, degToRad, radToDeg, rand, randFloat, randHalt, randInt, randRound } from './chunk-VFKAZAWF.mjs';
2
- import './chunk-AKU6F3WT.mjs';