diginext-utils 2.1.18 → 2.1.20

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 (199) hide show
  1. package/dist/Checker.d.ts +8 -8
  2. package/dist/Checker.js +31 -31
  3. package/dist/EventDispatcher.d.ts +13 -13
  4. package/dist/EventDispatcher.js +51 -51
  5. package/dist/FileUpload.d.ts +12 -12
  6. package/dist/FileUpload.js +64 -64
  7. package/dist/Slug.d.ts +9 -9
  8. package/dist/Slug.js +333 -333
  9. package/dist/Timer.d.ts +4 -4
  10. package/dist/Timer.js +8 -8
  11. package/dist/Validation.d.ts +5 -5
  12. package/dist/Validation.js +38 -38
  13. package/dist/array.d.ts +113 -113
  14. package/dist/array.js +297 -297
  15. package/dist/color.d.ts +25 -25
  16. package/dist/color.js +95 -95
  17. package/dist/console/enableConsole.d.ts +2 -2
  18. package/dist/console/enableConsole.js +13 -13
  19. package/dist/console/index.d.ts +11 -11
  20. package/dist/console/index.js +17 -17
  21. package/dist/console/log.d.ts +15 -15
  22. package/dist/console/log.js +44 -44
  23. package/dist/device/browser.d.ts +5 -5
  24. package/dist/device/browser.js +37 -37
  25. package/dist/device/camera.d.ts +7 -7
  26. package/dist/device/camera.js +171 -171
  27. package/dist/device/index.d.ts +5 -5
  28. package/dist/device/index.js +224 -224
  29. package/dist/device/os.d.ts +11 -11
  30. package/dist/device/os.js +37 -37
  31. package/dist/file/createDir.d.ts +5 -5
  32. package/dist/file/createDir.js +15 -15
  33. package/dist/file/fileMove.d.ts +4 -4
  34. package/dist/file/fileMove.js +32 -32
  35. package/dist/file/findFilesByExt.d.ts +13 -13
  36. package/dist/file/findFilesByExt.js +49 -49
  37. package/dist/file/index.d.ts +9 -9
  38. package/dist/file/index.js +10 -10
  39. package/dist/gameboi/index.d.ts +10 -10
  40. package/dist/gameboi/index.js +64 -67
  41. package/dist/gameboi/index.js.map +1 -1
  42. package/dist/images/downloadByUrl.d.ts +1 -1
  43. package/dist/images/downloadByUrl.js +55 -55
  44. package/dist/images/index.d.ts +2 -2
  45. package/dist/images/index.js +8 -8
  46. package/dist/images/loadImage.d.ts +1 -1
  47. package/dist/images/loadImage.js +17 -17
  48. package/dist/images/resize.d.ts +2 -2
  49. package/dist/images/resize.js +37 -37
  50. package/dist/images/upload.d.ts +10 -10
  51. package/dist/images/upload.js +26 -26
  52. package/dist/index.d.ts +37 -37
  53. package/dist/index.js +62 -62
  54. package/dist/json.d.ts +8 -8
  55. package/dist/json.js +31 -31
  56. package/dist/math/diffDate.d.ts +5 -5
  57. package/dist/math/diffDate.js +13 -13
  58. package/dist/math/index.d.ts +30 -30
  59. package/dist/math/index.js +92 -92
  60. package/dist/math/positiveNumber.d.ts +2 -2
  61. package/dist/math/positiveNumber.js +16 -16
  62. package/dist/name/en.d.ts +5 -5
  63. package/dist/name/en.js +25 -25
  64. package/dist/name/index.d.ts +12 -12
  65. package/dist/name/index.js +12 -12
  66. package/dist/name/vi.d.ts +5 -5
  67. package/dist/name/vi.js +27 -27
  68. package/dist/object.d.ts +59 -59
  69. package/dist/object.js +79 -79
  70. package/dist/permission/index.d.ts +8 -8
  71. package/dist/permission/index.js +6 -6
  72. package/dist/permission/requestCamera.d.ts +5 -5
  73. package/dist/permission/requestCamera.js +42 -42
  74. package/dist/permission/requestDeviceOrientationControl.d.ts +2 -2
  75. package/dist/permission/requestDeviceOrientationControl.js +38 -38
  76. package/dist/response/index.d.ts +49 -49
  77. package/dist/response/index.js +51 -51
  78. package/dist/string/convertPathnameAndQuery.d.ts +4 -4
  79. package/dist/string/convertPathnameAndQuery.js +24 -24
  80. package/dist/string/formatNumber.d.ts +6 -6
  81. package/dist/string/formatNumber.js +14 -14
  82. package/dist/string/generatePassword.d.ts +9 -9
  83. package/dist/string/generatePassword.js +23 -23
  84. package/dist/string/generateUUID.d.ts +2 -2
  85. package/dist/string/generateUUID.js +36 -36
  86. package/dist/string/getTextBetweenCharByIndex.d.ts +1 -1
  87. package/dist/string/getTextBetweenCharByIndex.js +20 -20
  88. package/dist/string/index.d.ts +65 -65
  89. package/dist/string/index.js +161 -161
  90. package/dist/string/indexesOf.d.ts +1 -1
  91. package/dist/string/indexesOf.js +14 -14
  92. package/dist/string/makeDaySlug.d.ts +31 -31
  93. package/dist/string/makeDaySlug.js +22 -22
  94. package/dist/string/random.d.ts +18 -18
  95. package/dist/string/random.js +40 -40
  96. package/dist/string/trimNull.d.ts +2 -2
  97. package/dist/string/trimNull.js +20 -20
  98. package/dist/string/url.d.ts +22 -22
  99. package/dist/string/url.js +74 -74
  100. package/esm/Checker.d.ts +8 -8
  101. package/esm/Checker.js +27 -27
  102. package/esm/EventDispatcher.d.ts +13 -13
  103. package/esm/EventDispatcher.js +48 -48
  104. package/esm/FileUpload.d.ts +12 -12
  105. package/esm/FileUpload.js +61 -61
  106. package/esm/Slug.d.ts +9 -9
  107. package/esm/Slug.js +329 -329
  108. package/esm/Timer.d.ts +4 -4
  109. package/esm/Timer.js +6 -6
  110. package/esm/Validation.d.ts +5 -5
  111. package/esm/Validation.js +36 -36
  112. package/esm/array.d.ts +113 -113
  113. package/esm/array.js +275 -275
  114. package/esm/color.d.ts +25 -25
  115. package/esm/color.js +85 -85
  116. package/esm/console/enableConsole.d.ts +2 -2
  117. package/esm/console/enableConsole.js +6 -6
  118. package/esm/console/index.d.ts +11 -11
  119. package/esm/console/index.js +12 -12
  120. package/esm/console/log.d.ts +15 -15
  121. package/esm/console/log.js +32 -32
  122. package/esm/device/browser.d.ts +5 -5
  123. package/esm/device/browser.js +29 -29
  124. package/esm/device/camera.d.ts +7 -7
  125. package/esm/device/camera.js +167 -167
  126. package/esm/device/index.d.ts +5 -5
  127. package/esm/device/index.js +216 -216
  128. package/esm/device/os.d.ts +11 -11
  129. package/esm/device/os.js +27 -27
  130. package/esm/file/createDir.d.ts +5 -5
  131. package/esm/file/createDir.js +12 -12
  132. package/esm/file/fileMove.d.ts +4 -4
  133. package/esm/file/fileMove.js +28 -28
  134. package/esm/file/findFilesByExt.d.ts +13 -13
  135. package/esm/file/findFilesByExt.js +45 -45
  136. package/esm/file/index.d.ts +9 -9
  137. package/esm/file/index.js +5 -5
  138. package/esm/gameboi/index.d.ts +10 -10
  139. package/esm/gameboi/index.js +61 -61
  140. package/esm/gameboi/index.js.map +1 -1
  141. package/esm/images/downloadByUrl.d.ts +1 -1
  142. package/esm/images/downloadByUrl.js +52 -52
  143. package/esm/images/index.d.ts +2 -2
  144. package/esm/images/index.js +3 -3
  145. package/esm/images/loadImage.d.ts +1 -1
  146. package/esm/images/loadImage.js +14 -14
  147. package/esm/images/resize.d.ts +2 -2
  148. package/esm/images/resize.js +30 -30
  149. package/esm/images/upload.d.ts +10 -10
  150. package/esm/images/upload.js +19 -19
  151. package/esm/index.d.ts +37 -37
  152. package/esm/index.js +37 -37
  153. package/esm/json.d.ts +8 -8
  154. package/esm/json.js +27 -27
  155. package/esm/math/diffDate.d.ts +5 -5
  156. package/esm/math/diffDate.js +9 -9
  157. package/esm/math/index.d.ts +30 -30
  158. package/esm/math/index.js +77 -77
  159. package/esm/math/positiveNumber.d.ts +2 -2
  160. package/esm/math/positiveNumber.js +12 -12
  161. package/esm/name/en.d.ts +5 -5
  162. package/esm/name/en.js +21 -21
  163. package/esm/name/index.d.ts +12 -12
  164. package/esm/name/index.js +5 -5
  165. package/esm/name/vi.d.ts +5 -5
  166. package/esm/name/vi.js +23 -23
  167. package/esm/object.d.ts +59 -59
  168. package/esm/object.js +69 -69
  169. package/esm/permission/index.d.ts +8 -8
  170. package/esm/permission/index.js +4 -4
  171. package/esm/permission/requestCamera.d.ts +5 -5
  172. package/esm/permission/requestCamera.js +38 -38
  173. package/esm/permission/requestDeviceOrientationControl.d.ts +2 -2
  174. package/esm/permission/requestDeviceOrientationControl.js +34 -34
  175. package/esm/response/index.d.ts +49 -49
  176. package/esm/response/index.js +45 -45
  177. package/esm/string/convertPathnameAndQuery.d.ts +4 -4
  178. package/esm/string/convertPathnameAndQuery.js +21 -21
  179. package/esm/string/formatNumber.d.ts +6 -6
  180. package/esm/string/formatNumber.js +10 -10
  181. package/esm/string/generatePassword.d.ts +9 -9
  182. package/esm/string/generatePassword.js +19 -19
  183. package/esm/string/generateUUID.d.ts +2 -2
  184. package/esm/string/generateUUID.js +32 -32
  185. package/esm/string/getTextBetweenCharByIndex.d.ts +1 -1
  186. package/esm/string/getTextBetweenCharByIndex.js +14 -14
  187. package/esm/string/index.d.ts +65 -65
  188. package/esm/string/index.js +150 -150
  189. package/esm/string/indexesOf.d.ts +1 -1
  190. package/esm/string/indexesOf.js +11 -11
  191. package/esm/string/makeDaySlug.d.ts +31 -31
  192. package/esm/string/makeDaySlug.js +15 -15
  193. package/esm/string/random.d.ts +18 -18
  194. package/esm/string/random.js +33 -33
  195. package/esm/string/trimNull.d.ts +2 -2
  196. package/esm/string/trimNull.js +13 -13
  197. package/esm/string/url.d.ts +22 -22
  198. package/esm/string/url.js +64 -64
  199. package/package.json +4 -4
@@ -1,34 +1,34 @@
1
- export const textLowCase = "abcdefghijklmnopqrstuvwxyz";
2
- export const numeric = "0123456789";
3
- export const punctuation = "!@#$%^&*()_+~|}{[];?><,./-=";
4
- export const allCharacter = `đĐaáàảãạăắằẳẵặâấầẩẫậeéèẻẽẹêếềểễệoóòỏõọôốồổỗộơớờởỡợiíìỉĩịuúùủũụưứừửữựyýỳỷỹỵAÁÀẢÃẠĂẮẰẲẴẶÂẤẦẨẪẬEÉÈẺẼẸÊẾỀỂỄỆOÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢIÍÌỈĨỊUÚÙỦŨỤƯỨỪỬỮỰYÝỲ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}`;
5
- /**
6
- * allCharacter = `đĐaáàảãạăắằẳẵặâấầẩẫậeéèẻẽẹêếềểễệoóòỏõọôốồổỗộơớờởỡợiíìỉĩịuúùủũụưứừửữựyýỳỷỹỵAÁÀẢÃẠĂẮẰẲẴẶÂẤẦẨẪẬEÉÈẺẼẸÊẾỀỂỄỆOÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢIÍÌỈĨỊUÚÙỦŨỤƯỨỪỬỮỰYÝỲ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}`;
7
- */
8
- export const randAllCharacterByLength = (length = 0) => {
9
- return randomStringByLength(length, allCharacter);
10
- };
11
- export const randomStringByLength = (length, str = textLowCase) => {
12
- let result = "";
13
- for (let i = 0; i < length; i++) {
14
- result += str.charAt(Math.floor(Math.random() * str.length));
15
- }
16
- return result;
17
- };
18
- export const randomStringAndNumberByLength = (length, str = `${textLowCase}${numeric}`) => {
19
- let result = "";
20
- for (let i = 0; i < length; i++) {
21
- result += str.charAt(Math.floor(Math.random() * str.length));
22
- }
23
- return result;
24
- };
25
- export const uniqueSortByTime = (length = 6, str = `${textLowCase}${numeric}`) => {
26
- let result = `${+new Date()}-`;
27
- for (let i = 0; i < length; i++) {
28
- result += str.charAt(Math.floor(Math.random() * str.length));
29
- }
30
- return result;
31
- };
32
- const random = { randAllCharacterByLength, randomStringByLength, randomStringAndNumberByLength, uniqueSortByTime };
33
- export default random;
1
+ export const textLowCase = "abcdefghijklmnopqrstuvwxyz";
2
+ export const numeric = "0123456789";
3
+ export const punctuation = "!@#$%^&*()_+~|}{[];?><,./-=";
4
+ export const allCharacter = `đĐaáàảãạăắằẳẵặâấầẩẫậeéèẻẽẹêếềểễệoóòỏõọôốồổỗộơớờởỡợiíìỉĩịuúùủũụưứừửữựyýỳỷỹỵAÁÀẢÃẠĂẮẰẲẴẶÂẤẦẨẪẬEÉÈẺẼẸÊẾỀỂỄỆOÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢIÍÌỈĨỊUÚÙỦŨỤƯỨỪỬỮỰYÝỲ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}`;
5
+ /**
6
+ * allCharacter = `đĐaáàảãạăắằẳẵặâấầẩẫậeéèẻẽẹêếềểễệoóòỏõọôốồổỗộơớờởỡợiíìỉĩịuúùủũụưứừửữựyýỳỷỹỵAÁÀẢÃẠĂẮẰẲẴẶÂẤẦẨẪẬEÉÈẺẼẸÊẾỀỂỄỆOÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢIÍÌỈĨỊUÚÙỦŨỤƯỨỪỬỮỰYÝỲ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}`;
7
+ */
8
+ export const randAllCharacterByLength = (length = 0) => {
9
+ return randomStringByLength(length, allCharacter);
10
+ };
11
+ export const randomStringByLength = (length, str = textLowCase) => {
12
+ let result = "";
13
+ for (let i = 0; i < length; i++) {
14
+ result += str.charAt(Math.floor(Math.random() * str.length));
15
+ }
16
+ return result;
17
+ };
18
+ export const randomStringAndNumberByLength = (length, str = `${textLowCase}${numeric}`) => {
19
+ let result = "";
20
+ for (let i = 0; i < length; i++) {
21
+ result += str.charAt(Math.floor(Math.random() * str.length));
22
+ }
23
+ return result;
24
+ };
25
+ export const uniqueSortByTime = (length = 6, str = `${textLowCase}${numeric}`) => {
26
+ let result = `${+new Date()}-`;
27
+ for (let i = 0; i < length; i++) {
28
+ result += str.charAt(Math.floor(Math.random() * str.length));
29
+ }
30
+ return result;
31
+ };
32
+ const random = { randAllCharacterByLength, randomStringByLength, randomStringAndNumberByLength, uniqueSortByTime };
33
+ export default random;
34
34
  //# sourceMappingURL=random.js.map
@@ -1,2 +1,2 @@
1
- export declare function trimNull(str: string): string;
2
- export default trimNull;
1
+ export declare function trimNull(str: string): string;
2
+ export default trimNull;
@@ -1,14 +1,14 @@
1
- import trim from "lodash/trim";
2
- export function trimNull(str) {
3
- if (!str)
4
- return "";
5
- str = str.toString();
6
- str = str.replace(/\0/g, "");
7
- while (str.indexOf(" ") >= 0) {
8
- str = str.replaceAll(" ", " ");
9
- }
10
- str = trim(str);
11
- return str;
12
- }
13
- export default trimNull;
1
+ import trim from "lodash/trim";
2
+ export function trimNull(str) {
3
+ if (!str)
4
+ return "";
5
+ str = str.toString();
6
+ str = str.replace(/\0/g, "");
7
+ while (str.indexOf(" ") >= 0) {
8
+ str = str.replaceAll(" ", " ");
9
+ }
10
+ str = trim(str);
11
+ return str;
12
+ }
13
+ export default trimNull;
14
14
  //# sourceMappingURL=trimNull.js.map
@@ -1,22 +1,22 @@
1
- export declare const addQueryParam: (_url: string, key: string, value: any) => string;
2
- export declare const getUrlParams: (parameter: string, staticURL?: string, decode?: boolean) => string | false | undefined;
3
- export declare const isLink: (str: string) => boolean;
4
- export declare const getFileNameWithoutExtension: (url: string) => string;
5
- export declare const getFileNameWithExtension: (url: string) => string;
6
- export declare const getFileExtension: (url: string) => string | null | undefined;
7
- /**
8
- *
9
- * @param {string} url
10
- * @returns
11
- */
12
- export declare const isImage: (url: string) => boolean;
13
- declare const xurl: {
14
- addQueryParam: (_url: string, key: string, value: any) => string;
15
- getUrlParams: (parameter: string, staticURL?: string, decode?: boolean) => string | false | undefined;
16
- isLink: (str: string) => boolean;
17
- getFileNameWithoutExtension: (url: string) => string;
18
- getFileNameWithExtension: (url: string) => string;
19
- getFileExtension: (url: string) => string | null | undefined;
20
- isImage: (url: string) => boolean;
21
- };
22
- export default xurl;
1
+ export declare const addQueryParam: (_url: string, key: string, value: any) => string;
2
+ export declare const getUrlParams: (parameter: string, staticURL?: string, decode?: boolean) => string | false | undefined;
3
+ export declare const isLink: (str: string) => boolean;
4
+ export declare const getFileNameWithoutExtension: (url: string) => string;
5
+ export declare const getFileNameWithExtension: (url: string) => string;
6
+ export declare const getFileExtension: (url: string) => string | null | undefined;
7
+ /**
8
+ *
9
+ * @param {string} url
10
+ * @returns
11
+ */
12
+ export declare const isImage: (url: string) => boolean;
13
+ declare const xurl: {
14
+ addQueryParam: (_url: string, key: string, value: any) => string;
15
+ getUrlParams: (parameter: string, staticURL?: string, decode?: boolean) => string | false | undefined;
16
+ isLink: (str: string) => boolean;
17
+ getFileNameWithoutExtension: (url: string) => string;
18
+ getFileNameWithExtension: (url: string) => string;
19
+ getFileExtension: (url: string) => string | null | undefined;
20
+ isImage: (url: string) => boolean;
21
+ };
22
+ export default xurl;
package/esm/string/url.js CHANGED
@@ -1,65 +1,65 @@
1
- var urlRegex = /(https?:\/\/[^\s]+)/g;
2
- export const addQueryParam = (_url, key, value) => {
3
- _url += (_url.split("?")[1] ? "&" : "?") + `${key}=${value}`;
4
- return _url;
5
- };
6
- export const getUrlParams = (parameter, staticURL, decode = true) => {
7
- if (typeof window == "undefined")
8
- return "";
9
- staticURL = staticURL == undefined ? window.location.host : staticURL;
10
- var currLocation = staticURL.length > 0 ? staticURL : window.location.search;
11
- if (currLocation.split("?").length < 2)
12
- return "";
13
- var parArr = currLocation.split("?")[1].split("&"), returnBool = true;
14
- for (var i = 0; i < parArr.length; i++) {
15
- var parr = parArr[i].split("=");
16
- if (parr[0] == parameter) {
17
- return decode ? decodeURIComponent(parr[1]) : parr[1];
18
- returnBool = true;
19
- }
20
- else {
21
- returnBool = false;
22
- }
23
- }
24
- if (!returnBool)
25
- return false;
26
- };
27
- export const isLink = (str) => {
28
- return urlRegex.test(str);
29
- };
30
- export const getFileNameWithoutExtension = (url) => {
31
- var _a, _b;
32
- return ((_b = (_a = getFileNameWithExtension(url)) === null || _a === void 0 ? void 0 : _a.split(".")) === null || _b === void 0 ? void 0 : _b[0]) || "";
33
- };
34
- export const getFileNameWithExtension = (url) => {
35
- url = url.replaceAll("\\", "/");
36
- const _url = decodeURIComponent(url);
37
- const m = `${_url.toString().match(/(?:.*\/)?([^\/]+)/)}`;
38
- if (m && m.split(",").length > 1) {
39
- return m.split(",")[1].replace(/(\?.*)|(\&.*)/, "");
40
- }
41
- return "";
42
- };
43
- export const getFileExtension = (url) => {
44
- const arr = getFileNameWithExtension(url).split(".");
45
- if (arr.length > 1)
46
- return getFileNameWithExtension(url).split(".").pop();
47
- return null;
48
- };
49
- /**
50
- *
51
- * @param {string} url
52
- * @returns
53
- */
54
- export const isImage = (url) => {
55
- if (!url)
56
- return false;
57
- const arr = [".png", ".jpg", ".jpeg", ".jpe", ".jif", ".jfif", ".gif", ".svg"];
58
- const index = arr.findIndex((item) => {
59
- return url.indexOf(item) >= 0;
60
- });
61
- return index >= 0;
62
- };
63
- const xurl = { addQueryParam, getUrlParams, isLink, getFileNameWithoutExtension, getFileNameWithExtension, getFileExtension, isImage };
64
- export default xurl;
1
+ var urlRegex = /(https?:\/\/[^\s]+)/g;
2
+ export const addQueryParam = (_url, key, value) => {
3
+ _url += (_url.split("?")[1] ? "&" : "?") + `${key}=${value}`;
4
+ return _url;
5
+ };
6
+ export const getUrlParams = (parameter, staticURL, decode = true) => {
7
+ if (typeof window == "undefined")
8
+ return "";
9
+ staticURL = staticURL == undefined ? window.location.host : staticURL;
10
+ var currLocation = staticURL.length > 0 ? staticURL : window.location.search;
11
+ if (currLocation.split("?").length < 2)
12
+ return "";
13
+ var parArr = currLocation.split("?")[1].split("&"), returnBool = true;
14
+ for (var i = 0; i < parArr.length; i++) {
15
+ var parr = parArr[i].split("=");
16
+ if (parr[0] == parameter) {
17
+ return decode ? decodeURIComponent(parr[1]) : parr[1];
18
+ returnBool = true;
19
+ }
20
+ else {
21
+ returnBool = false;
22
+ }
23
+ }
24
+ if (!returnBool)
25
+ return false;
26
+ };
27
+ export const isLink = (str) => {
28
+ return urlRegex.test(str);
29
+ };
30
+ export const getFileNameWithoutExtension = (url) => {
31
+ var _a, _b;
32
+ return ((_b = (_a = getFileNameWithExtension(url)) === null || _a === void 0 ? void 0 : _a.split(".")) === null || _b === void 0 ? void 0 : _b[0]) || "";
33
+ };
34
+ export const getFileNameWithExtension = (url) => {
35
+ url = url.replaceAll("\\", "/");
36
+ const _url = decodeURIComponent(url);
37
+ const m = `${_url.toString().match(/(?:.*\/)?([^\/]+)/)}`;
38
+ if (m && m.split(",").length > 1) {
39
+ return m.split(",")[1].replace(/(\?.*)|(\&.*)/, "");
40
+ }
41
+ return "";
42
+ };
43
+ export const getFileExtension = (url) => {
44
+ const arr = getFileNameWithExtension(url).split(".");
45
+ if (arr.length > 1)
46
+ return getFileNameWithExtension(url).split(".").pop();
47
+ return null;
48
+ };
49
+ /**
50
+ *
51
+ * @param {string} url
52
+ * @returns
53
+ */
54
+ export const isImage = (url) => {
55
+ if (!url)
56
+ return false;
57
+ const arr = [".png", ".jpg", ".jpeg", ".jpe", ".jif", ".jfif", ".gif", ".svg"];
58
+ const index = arr.findIndex((item) => {
59
+ return url.indexOf(item) >= 0;
60
+ });
61
+ return index >= 0;
62
+ };
63
+ const xurl = { addQueryParam, getUrlParams, isLink, getFileNameWithoutExtension, getFileNameWithExtension, getFileExtension, isImage };
64
+ export default xurl;
65
65
  //# sourceMappingURL=url.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginext-utils",
3
- "version": "2.1.18",
3
+ "version": "2.1.20",
4
4
  "sideEffects": false,
5
5
  "readme": "README.md",
6
6
  "homepage": "https://wearetopgroup.com",
@@ -26,10 +26,10 @@
26
26
  "build": "npm run prebuild && tsc --module commonjs --outDir dist && tsc --module esnext --outDir esm && npm run test",
27
27
  "build_tsup": "tsup src/**/*.ts --format esm,cjs --dts --legacy-output",
28
28
  "prebuild": "rm -rf dist && rm -rf esm",
29
- "release": "npm run prebuild && npm run build && npm run publish",
29
+ "release": "npm run build && npm run publish",
30
30
  "dev": "npm run prebuild && concurrently \"tsup src/**/*.ts --format esm,cjs --dts --watch\"",
31
31
  "test": "mocha test/*.test.js",
32
- "publish": "npm run build && npm run test && npm publish",
32
+ "publish": "npm run build && npm publish",
33
33
  "lint": "TIMING=1 eslint src --fix",
34
34
  "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
35
35
  },
@@ -64,4 +64,4 @@
64
64
  "esm": "^3.2.25",
65
65
  "mocha": "^10.0.0"
66
66
  }
67
- }
67
+ }