diginext-utils 3.0.5 → 3.0.7

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 (79) hide show
  1. package/dist/Checker.d.ts +3 -4
  2. package/dist/EventDispatcher.d.ts +3 -3
  3. package/dist/FileUpload.d.ts +3 -3
  4. package/dist/Slug.d.ts +3 -4
  5. package/dist/Timer.d.ts +4 -1
  6. package/dist/Validation.d.ts +2 -3
  7. package/dist/array.d.ts +113 -1
  8. package/dist/color.d.ts +9 -10
  9. package/dist/device/browser.d.ts +5 -1
  10. package/dist/device/browser.js +3 -3
  11. package/dist/device/browser.js.map +1 -1
  12. package/dist/device/camera.d.ts +7 -1
  13. package/dist/device/index.d.ts +5 -1
  14. package/dist/device/os.d.ts +6 -7
  15. package/dist/file/createDir.d.ts +5 -1
  16. package/dist/file/detectPrivateKey.d.ts +3 -4
  17. package/dist/file/detectPrivateKeyByFilePath.d.ts +2 -3
  18. package/dist/file/detectPrivateKeyByFilePath.js +5 -2
  19. package/dist/file/detectPrivateKeyByFilePath.js.map +1 -1
  20. package/dist/file/fileMove.d.ts +4 -1
  21. package/dist/file/findFilesByExt.d.ts +13 -1
  22. package/dist/file/getAllFiles.d.ts +1 -3
  23. package/dist/file/index.d.ts +4 -6
  24. package/dist/gameboi/index.d.ts +4 -6
  25. package/dist/html/transform3dToObject.d.ts +2 -4
  26. package/dist/images/downloadByUrl.d.ts +1 -3
  27. package/dist/images/index.d.ts +2 -2
  28. package/dist/images/loadImage.d.ts +1 -3
  29. package/dist/images/resize.d.ts +2 -3
  30. package/dist/images/upload.d.ts +3 -4
  31. package/dist/index.d.ts +19 -30
  32. package/dist/json.d.ts +3 -4
  33. package/dist/math/diffDate.d.ts +2 -3
  34. package/dist/math/index.d.ts +30 -3
  35. package/dist/math/positiveNumber.d.ts +2 -3
  36. package/dist/name/en.d.ts +3 -4
  37. package/dist/name/index.d.ts +12 -3
  38. package/dist/name/vi.d.ts +3 -4
  39. package/dist/object.d.ts +31 -1
  40. package/dist/permission/index.d.ts +2 -3
  41. package/dist/permission/requestCamera.d.ts +5 -1
  42. package/dist/permission/requestDeviceOrientationControl.d.ts +2 -1
  43. package/dist/response/index.d.ts +6 -7
  44. package/dist/string/convertPathnameAndQuery.d.ts +2 -4
  45. package/dist/string/formatNumber.d.ts +2 -3
  46. package/dist/string/generatePassword.d.ts +2 -3
  47. package/dist/string/generateUUID.d.ts +2 -3
  48. package/dist/string/getTextBetweenCharByIndex.d.ts +1 -3
  49. package/dist/string/index.d.ts +65 -6
  50. package/dist/string/indexesOf.d.ts +1 -3
  51. package/dist/string/makeDaySlug.d.ts +3 -4
  52. package/dist/string/random.d.ts +10 -11
  53. package/dist/string/trimNull.d.ts +2 -3
  54. package/dist/string/url.d.ts +22 -1
  55. package/dist/xconsole/enableConsole.d.ts +2 -1
  56. package/dist/xconsole/index.d.ts +11 -2
  57. package/dist/xconsole/log.d.ts +8 -9
  58. package/esm/device/browser.js +3 -3
  59. package/esm/device/browser.js.map +1 -1
  60. package/esm/file/detectPrivateKeyByFilePath.js +5 -2
  61. package/esm/file/detectPrivateKeyByFilePath.js.map +1 -1
  62. package/package.json +31 -23
  63. package/dist/Timer-7b0c4e7c.d.ts +0 -11
  64. package/dist/array-c38eff4c.d.ts +0 -158
  65. package/dist/browser-8d042ffe.d.ts +0 -22
  66. package/dist/camera-1a859d72.d.ts +0 -15
  67. package/dist/createDir-220e0081.d.ts +0 -13
  68. package/dist/enableConsole-ddc24282.d.ts +0 -11
  69. package/dist/fileMove-3a09e429.d.ts +0 -13
  70. package/dist/findFilesByExt-753e91d7.d.ts +0 -24
  71. package/dist/index-11ec3903.d.ts +0 -26
  72. package/dist/index-1f738e52.d.ts +0 -22
  73. package/dist/index-22309f0c.d.ts +0 -23
  74. package/dist/index-3eeb7834.d.ts +0 -90
  75. package/dist/index-6ae3c86b.d.ts +0 -63
  76. package/dist/object-210cae96.d.ts +0 -52
  77. package/dist/requestCamera-32b7dfc7.d.ts +0 -14
  78. package/dist/requestDeviceOrientationControl-b6458660.d.ts +0 -11
  79. package/dist/url-0da0be84.d.ts +0 -43
package/dist/object.d.ts CHANGED
@@ -1 +1,31 @@
1
- export { x as default, i as isNull, e as iterate, d as objectToArray, c as toArray, t as toBool, b as toFloat, a as toInt } from './object-210cae96.js';
1
+ export declare const isNull: (object: any) => boolean;
2
+ export declare const toBool: (object: any) => boolean;
3
+ export declare const toInt: (object: any) => number;
4
+ export declare const toFloat: (object: any) => number;
5
+ export declare const toArray: (object: any) => any;
6
+ /**
7
+ * Convert value in object to array
8
+ */
9
+ export declare const objectToArray: (object: any) => any[];
10
+ /**
11
+ * Iterate through every keys & values of the object
12
+ */
13
+ export declare const iterate: (obj: {
14
+ [key: string]: any;
15
+ }, callbackFn: (obj: any, key?: string, value?: any) => any) => {
16
+ [key: string]: any;
17
+ };
18
+ declare const xobject: {
19
+ isNull: (object: any) => boolean;
20
+ toBool: (object: any) => boolean;
21
+ toInt: (object: any) => number;
22
+ toFloat: (object: any) => number;
23
+ toArray: (object: any) => any;
24
+ objectToArray: (object: any) => any[];
25
+ iterate: (obj: {
26
+ [key: string]: any;
27
+ }, callbackFn: (obj: any, key?: string, value?: any) => any) => {
28
+ [key: string]: any;
29
+ };
30
+ };
31
+ export default xobject;
@@ -4,6 +4,5 @@ declare const permission: {
4
4
  video?: boolean | undefined;
5
5
  }) => false | Promise<unknown>;
6
6
  requestDeviceOrientationControl: () => false | Promise<unknown>;
7
- };
8
-
9
- export { permission as default };
7
+ };
8
+ export default permission;
@@ -1 +1,5 @@
1
- export { a as default, a as requestCamera } from '../requestCamera-32b7dfc7.js';
1
+ export declare const requestCamera: ({ audio, video }: {
2
+ audio?: boolean | undefined;
3
+ video?: boolean | undefined;
4
+ }) => false | Promise<unknown>;
5
+ export default requestCamera;
@@ -1 +1,2 @@
1
- export { a as default, a as requestDeviceOrientationControl } from '../requestDeviceOrientationControl-b6458660.js';
1
+ export declare const requestDeviceOrientationControl: () => false | Promise<unknown>;
2
+ export default requestDeviceOrientationControl;
@@ -1,20 +1,20 @@
1
- declare const getResponse: () => {
1
+ export declare const getResponse: () => {
2
2
  status: number;
3
3
  messages: never[];
4
4
  data: null;
5
5
  };
6
- declare const getSuccessResponse: (data: any, message?: string) => {
6
+ export declare const getSuccessResponse: (data: any, message?: string) => {
7
7
  status: number;
8
8
  messages: string[];
9
9
  data: any;
10
10
  };
11
- declare const getFailedResponse: (...messages: any[]) => {
11
+ export declare const getFailedResponse: (...messages: any[]) => {
12
12
  status: number;
13
13
  error: boolean;
14
14
  messages: any[];
15
15
  data: null;
16
16
  };
17
- declare const Response: {
17
+ export declare const Response: {
18
18
  send: (res: any, data?: any) => any;
19
19
  succeed: (res: any, data?: any) => any;
20
20
  failed: (res: any, ...messages: string[]) => any;
@@ -45,6 +45,5 @@ declare const response: {
45
45
  rejected: (res: any, message?: string) => any;
46
46
  ignore: (res: any, message?: string) => any;
47
47
  };
48
- };
49
-
50
- export { Response, response as default, getFailedResponse, getResponse, getSuccessResponse };
48
+ };
49
+ export default response;
@@ -1,6 +1,4 @@
1
- declare function convertPathnameAndQuery(url: string): {
1
+ export default function convertPathnameAndQuery(url: string): {
2
2
  pathname: string;
3
3
  query: any;
4
- } | null;
5
-
6
- export { convertPathnameAndQuery as default };
4
+ } | null;
@@ -2,6 +2,5 @@
2
2
  * Format the input number with commas
3
3
  * @example 1000000 -> 1,000,000
4
4
  */
5
- declare function formatNumber(num: number, prefix?: string): string;
6
-
7
- export { formatNumber as default, formatNumber };
5
+ export declare function formatNumber(num: number, prefix?: string): string;
6
+ export default formatNumber;
@@ -5,6 +5,5 @@
5
5
  * @param {Boolean} hard
6
6
  * @returns
7
7
  */
8
- declare function generatePassword(length?: number, hard?: boolean): string;
9
-
10
- export { generatePassword as default, generatePassword };
8
+ export declare function generatePassword(length?: number, hard?: boolean): string;
9
+ export default generatePassword;
@@ -1,3 +1,2 @@
1
- declare function generateUUID(): string;
2
-
3
- export { generateUUID as default, generateUUID };
1
+ export declare function generateUUID(): string;
2
+ export default generateUUID;
@@ -1,3 +1 @@
1
- declare function getTextBetweenCharByIndex(str: string, char: any, index: Number): string;
2
-
3
- export { getTextBetweenCharByIndex as default };
1
+ export default function getTextBetweenCharByIndex(str: string, char: any, index: Number): string;
@@ -1,6 +1,65 @@
1
- import './makeDaySlug.js';
2
- import './generateUUID.js';
3
- import './formatNumber.js';
4
- import './generatePassword.js';
5
- import './trimNull.js';
6
- export { c as capitalize, d as capitalizeName, e as clearUnicodeCharacters, x as default, g as getBetween, m as makeString, b as titleize, a as toLowerCase, t as toUpperCase } from '../index-3eeb7834.js';
1
+ /**
2
+ * Get string between str1 and str2 from text
3
+ */
4
+ export declare const getBetween: (text: string, str1: string, str2?: string) => string;
5
+ /**
6
+ * Convert object to string
7
+ */
8
+ export declare const makeString: (object?: any) => string;
9
+ /**
10
+ * toUpperCase
11
+ */
12
+ export declare const toUpperCase: (str?: string) => string;
13
+ /**
14
+ * toLowerCase
15
+ */
16
+ export declare const toLowerCase: (str?: string) => string;
17
+ /**
18
+ * toLowerCase
19
+ * @param {*} str
20
+ * @return {string}
21
+ */
22
+ export declare const titleize: (str?: string) => string;
23
+ /**
24
+ * Convert only first charater to UpperCase
25
+ */
26
+ export declare const capitalize: (str: string | any, lowercaseRest?: number) => any;
27
+ /**
28
+ * Convert first character from every single words to UpperCase
29
+ */
30
+ export declare const capitalizeName: (str: string) => string;
31
+ export declare const clearUnicodeCharacters: (s: string, opt?: {
32
+ [key: string]: any;
33
+ }) => string;
34
+ import { makeDaySlug } from "./makeDaySlug";
35
+ import { generateUUID } from "./generateUUID";
36
+ import { formatNumber } from "./formatNumber";
37
+ import { generatePassword } from "./generatePassword";
38
+ import { trimNull } from "./trimNull";
39
+ declare const xstring: {
40
+ getBetween: (text: string, str1: string, str2?: string) => string;
41
+ makeString: (object?: any) => string;
42
+ makeDaySlug: typeof makeDaySlug;
43
+ toUpperCase: (str?: string) => string;
44
+ toLowerCase: (str?: string) => string;
45
+ titleize: (str?: string) => string;
46
+ capitalize: (str: string | any, lowercaseRest?: number) => any;
47
+ capitalizeName: (str: string) => string;
48
+ clearUnicodeCharacters: (s: string, opt?: {
49
+ [key: string]: any;
50
+ }) => string;
51
+ generateUUID: typeof generateUUID;
52
+ randAllCharacterByLength: (length?: number) => string;
53
+ randomStringByLength: (length: number, str?: string) => string;
54
+ formatNumber: typeof formatNumber;
55
+ generatePassword: typeof generatePassword;
56
+ trimNull: typeof trimNull;
57
+ addQueryParam: (_url: string, key: string, value: any) => string;
58
+ getUrlParams: (parameter: string, staticURL?: string | undefined, decode?: boolean) => string | false | undefined;
59
+ isLink: (str: string) => boolean;
60
+ getFileNameWithoutExtension: (url: string) => string;
61
+ getFileNameWithExtension: (url: string) => string;
62
+ getFileExtension: (url: string) => string | null | undefined;
63
+ isImage: (url: string) => boolean;
64
+ };
65
+ export default xstring;
@@ -1,3 +1 @@
1
- declare function indexesOf(str: string, regex: any): any[];
2
-
3
- export { indexesOf as default };
1
+ export default function indexesOf(str: string, regex: any): any[];
@@ -24,9 +24,8 @@ type DaySlugOptions = {
24
24
  * Format the input number with commas
25
25
  * @example 1000000 -> 1,000,000
26
26
  */
27
- declare function makeDaySlug(options?: DaySlugOptions): string;
27
+ export declare function makeDaySlug(options?: DaySlugOptions): string;
28
28
  declare const _default: {
29
29
  makeDaySlug: typeof makeDaySlug;
30
- };
31
-
32
- export { _default as default, makeDaySlug };
30
+ };
31
+ export default _default;
@@ -1,19 +1,18 @@
1
- declare const textLowCase = "abcdefghijklmnopqrstuvwxyz";
2
- declare const numeric = "0123456789";
3
- declare const punctuation = "!@#$%^&*()_+~|}{[];?><,./-=";
4
- declare const allCharacter = "\u0111\u0110a\u00E1\u00E0\u1EA3\u00E3\u1EA1\u0103\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u00E2\u1EA5\u1EA7\u1EA9\u1EAB\u1EADe\u00E9\u00E8\u1EBB\u1EBD\u1EB9\u00EA\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7o\u00F3\u00F2\u1ECF\u00F5\u1ECD\u00F4\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u01A1\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3i\u00ED\u00EC\u1EC9\u0129\u1ECBu\u00FA\u00F9\u1EE7\u0169\u1EE5\u01B0\u1EE9\u1EEB\u1EED\u1EEF\u1EF1y\u00FD\u1EF3\u1EF7\u1EF9\u1EF5A\u00C1\u00C0\u1EA2\u00C3\u1EA0\u0102\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u00C2\u1EA4\u1EA6\u1EA8\u1EAA\u1EACE\u00C9\u00C8\u1EBA\u1EBC\u1EB8\u00CA\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6O\u00D3\u00D2\u1ECE\u00D5\u1ECC\u00D4\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u01A0\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2I\u00CD\u00CC\u1EC8\u0128\u1ECAU\u00DA\u00D9\u1EE6\u0168\u1EE4\u01AF\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0Y\u00DD\u1EF2 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}";
1
+ export declare const textLowCase = "abcdefghijklmnopqrstuvwxyz";
2
+ export declare const numeric = "0123456789";
3
+ export declare const punctuation = "!@#$%^&*()_+~|}{[];?><,./-=";
4
+ export declare const allCharacter = "\u0111\u0110a\u00E1\u00E0\u1EA3\u00E3\u1EA1\u0103\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u00E2\u1EA5\u1EA7\u1EA9\u1EAB\u1EADe\u00E9\u00E8\u1EBB\u1EBD\u1EB9\u00EA\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7o\u00F3\u00F2\u1ECF\u00F5\u1ECD\u00F4\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u01A1\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3i\u00ED\u00EC\u1EC9\u0129\u1ECBu\u00FA\u00F9\u1EE7\u0169\u1EE5\u01B0\u1EE9\u1EEB\u1EED\u1EEF\u1EF1y\u00FD\u1EF3\u1EF7\u1EF9\u1EF5A\u00C1\u00C0\u1EA2\u00C3\u1EA0\u0102\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u00C2\u1EA4\u1EA6\u1EA8\u1EAA\u1EACE\u00C9\u00C8\u1EBA\u1EBC\u1EB8\u00CA\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6O\u00D3\u00D2\u1ECE\u00D5\u1ECC\u00D4\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u01A0\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2I\u00CD\u00CC\u1EC8\u0128\u1ECAU\u00DA\u00D9\u1EE6\u0168\u1EE4\u01AF\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0Y\u00DD\u1EF2 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}";
5
5
  /**
6
6
  * allCharacter = `đĐaáàảãạăắằẳẵặâấầẩẫậeéèẻẽẹêếềểễệoóòỏõọôốồổỗộơớờởỡợiíìỉĩịuúùủũụưứừửữựyýỳỷỹỵAÁÀẢÃẠĂẮẰẲẴẶÂẤẦẨẪẬEÉÈẺẼẸÊẾỀỂỄỆOÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢIÍÌỈĨỊUÚÙỦŨỤƯỨỪỬỮỰYÝỲ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}`;
7
7
  */
8
- declare const randAllCharacterByLength: (length?: number) => string;
9
- declare const randomStringByLength: (length: number, str?: string) => string;
10
- declare const randomStringAndNumberByLength: (length: number, str?: string) => string;
11
- declare const uniqueSortByTime: (length?: number, str?: string) => string;
8
+ export declare const randAllCharacterByLength: (length?: number) => string;
9
+ export declare const randomStringByLength: (length: number, str?: string) => string;
10
+ export declare const randomStringAndNumberByLength: (length: number, str?: string) => string;
11
+ export declare const uniqueSortByTime: (length?: number, str?: string) => string;
12
12
  declare const random: {
13
13
  randAllCharacterByLength: (length?: number) => string;
14
14
  randomStringByLength: (length: number, str?: string) => string;
15
15
  randomStringAndNumberByLength: (length: number, str?: string) => string;
16
16
  uniqueSortByTime: (length?: number, str?: string) => string;
17
- };
18
-
19
- export { allCharacter, random as default, numeric, punctuation, randAllCharacterByLength, randomStringAndNumberByLength, randomStringByLength, textLowCase, uniqueSortByTime };
17
+ };
18
+ export default random;
@@ -1,3 +1,2 @@
1
- declare function trimNull(str: string): string;
2
-
3
- export { trimNull as default, trimNull };
1
+ export declare function trimNull(str: string): string;
2
+ export default trimNull;
@@ -1 +1,22 @@
1
- export { a as addQueryParam, x as default, d as getFileExtension, c as getFileNameWithExtension, b as getFileNameWithoutExtension, g as getUrlParams, e as isImage, i as isLink } from '../url-0da0be84.js';
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 +1,2 @@
1
- export { a as default, a as enableConsole } from '../enableConsole-ddc24282.js';
1
+ export declare function enableConsole(): Console;
2
+ export default enableConsole;
@@ -1,2 +1,11 @@
1
- import '../enableConsole-ddc24282.js';
2
- export { x as default, d as disableConsole, r as removeConsole, s as showCredit } from '../index-11ec3903.js';
1
+ export declare const disableConsole: () => void;
2
+ export declare const removeConsole: () => void;
3
+ export declare const showCredit: (version?: string | number) => void;
4
+ import { enableConsole } from "./enableConsole";
5
+ declare const xconsole: {
6
+ enableConsole: typeof enableConsole;
7
+ disableConsole: () => void;
8
+ removeConsole: () => void;
9
+ showCredit: (version?: string | number) => void;
10
+ };
11
+ export default xconsole;
@@ -1,9 +1,9 @@
1
- declare const log: (...msg: any) => any;
2
- declare const logFull: (data?: {}) => {};
3
- declare const logRes: (res: any, ...msg: any[]) => any[];
4
- declare const logError: (...msg: any[]) => any[];
5
- declare const logWarn: (...msg: any[]) => any[];
6
- declare const logSuccess: (...msg: any[]) => any[];
1
+ export declare const log: (...msg: any) => any;
2
+ export declare const logFull: (data?: {}) => {};
3
+ export declare const logRes: (res: any, ...msg: any[]) => any[];
4
+ export declare const logError: (...msg: any[]) => any[];
5
+ export declare const logWarn: (...msg: any[]) => any[];
6
+ export declare const logSuccess: (...msg: any[]) => any[];
7
7
  declare const xlog: {
8
8
  log: (...msg: any) => any;
9
9
  logFull: (data?: {}) => {};
@@ -11,6 +11,5 @@ declare const xlog: {
11
11
  logError: (...msg: any[]) => any[];
12
12
  logWarn: (...msg: any[]) => any[];
13
13
  logSuccess: (...msg: any[]) => any[];
14
- };
15
-
16
- export { xlog as default, log, logError, logFull, logRes, logSuccess, logWarn };
14
+ };
15
+ export default xlog;
@@ -16,9 +16,9 @@ export const ua = () => {
16
16
  return navigator.userAgent || navigator.vendor || window.opera;
17
17
  };
18
18
  export const isFacebookWebview = () => {
19
- var ua = ua();
20
- if (typeof ua != "undefined")
21
- return ua.indexOf("FBAN") > -1 || ua.indexOf("FBAV") > -1;
19
+ const _ua = ua();
20
+ if (typeof _ua != "undefined")
21
+ return _ua.indexOf("FBAN") > -1 || _ua.indexOf("FBAV") > -1;
22
22
  };
23
23
  export const isInAppWebview = () => {
24
24
  const rules = ["WebView", "(iPhone|iPod|iPad)(?!.*Safari/)", "Android.*(wv|.0.0.0)"];
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/device/browser.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC7B,IAAI,OAAO,MAAM,IAAI,WAAW;QAAE,OAAO,KAAK,CAAC;IAE/C,IAAI,CAAC,MAAM,CAAC,WAAW;QAAE,OAAO,MAAM,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC;IACrF,OAAO,CAAC,CAAC,MAAM,CAAC,WAAW,KAAK,EAAE,IAAI,MAAM,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC/B,OAAO,CAAC,SAAS,EAAE,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;IACtB,IAAI,OAAO,SAAS,IAAI,WAAW;QAAE,OAAO,IAAI,CAAC;IACjD,IAAI,OAAO,MAAM,IAAI,WAAW;QAAE,OAAO,IAAI,CAAC;IAE9C,OAAO,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,IAAK,MAAc,CAAC,KAAK,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,IAAI,EAAE,GAAQ,EAAE,EAAE,CAAC;IACnB,IAAI,OAAO,EAAE,IAAI,WAAW;QAAE,OAAO,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,C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AC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,MAAM,GAAG,GAAQ,EAAE,EAAE,CAAC;IACtB,IAAI,OAAO,GAAG,IAAI,WAAW;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IAClC,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,iCAAiC,EAAE,sBAAsB,CAAC,CAAC;IACrF,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACvD,IAAI,EAAE,EAAE;QAAE,OAAO,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
@@ -1,12 +1,15 @@
1
1
  import fs from "fs";
2
+ import { toBool } from "../object";
2
3
  export default function detectPrivateKeyByFilePath(_path) {
3
4
  //
4
5
  if (!fs.existsSync(_path))
5
6
  return true;
6
- const fileContents = fs.readFileSync(_path);
7
+ const fileContents = fs.readFileSync(_path, "utf8");
8
+ const secretPattern = /((SECRET|TOKEN|PRIVATE)[\S+|=]+[\S]+)/g;
9
+ // console.log(fileContents.match(secretPattern));
7
10
  switch (true) {
8
11
  case fileContents.includes(`${`-----`}BEGIN `):
9
- case _path.includes(".env") && fileContents.includes("SECRET=") && !fileContents.includes("SECRET=\n") && !fileContents.includes("SECRET=*"):
12
+ case _path.includes(".env") && toBool(fileContents.match(secretPattern)):
10
13
  return false;
11
14
  default:
12
15
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"detectPrivateKeyByFilePath.js","sourceRoot":"","sources":["../../src/file/detectPrivateKeyByFilePath.ts"],"names":[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C,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC;QACd;YACC,MAAM;KACP;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginext-utils",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "sideEffects": false,
5
5
  "readme": "README.md",
6
6
  "homepage": "https://wearetopgroup.com",
@@ -23,48 +23,56 @@
23
23
  "esm"
24
24
  ],
25
25
  "scripts": {
26
- "build": "npm run prebuild && tsc --module commonjs --outDir dist && tsc --module esnext --outDir esm && npm run test",
27
- "build_tsup": "tsup src/**/*.ts --format esm,cjs --dts --legacy-output",
28
- "prebuild": "run-script-os || exit 0",
29
- "prebuild:win32": "rd /S /Q dist esm",
30
- "prebuild:darwin:linux": "rm -rf dist && rm -rf esm",
31
- "prebuild:default": "rm -rf dist && rm -rf esm",
26
+ "build": "npm run clean && tsc --module commonjs --outDir dist && tsc --module esnext --outDir esm && npm run test",
27
+ "dev": "nodemon tsc --module commonjs --outDir dist",
28
+ "clean": "rimraf dist esm",
32
29
  "release": "npm run build && npm publish",
33
- "dev": "npm run prebuild && concurrently \"tsup src/**/*.ts --format esm,cjs --dts --watch\"",
34
30
  "test": "mocha test/*.test.js",
35
- "lint": "TIMING=1 eslint src --fix",
36
- "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
31
+ "lint": "TIMING=1 eslint src --fix"
37
32
  },
38
33
  "dependencies": {
39
- "@types/file-saver": "^2.0.5",
40
- "@types/jest": "^26.0.22",
41
- "@types/node": "^18.8.5",
42
- "@types/react": "^17.0.13",
43
- "@types/react-dom": "^17.0.8",
44
34
  "blueimp-load-image": "^5.16.0",
45
- "run-script-os": "^1.1.6",
46
35
  "chalk": "4.1.2",
47
36
  "concurrently": "^7.2.2",
48
- "config": "*",
49
- "core-js": "^3.24.1",
50
37
  "dayjs": "^1.11.5",
51
- "esm": "^3.2.25",
52
38
  "file-saver": "^2.0.5",
53
39
  "gsap": "^3.10.4",
54
- "lodash": "^4.17.21",
55
- "tsconfig": "*",
56
- "tsup": "^6.1.3",
57
- "typescript": "^4.5.3"
40
+ "lodash": "^4.17.21"
58
41
  },
59
42
  "publishConfig": {
60
43
  "access": "public"
61
44
  },
62
45
  "devDependencies": {
46
+ "@types/file-saver": "^2.0.5",
47
+ "@types/jest": "^26.0.22",
48
+ "@types/node": "^18.8.5",
49
+ "@types/react": "^17.0.13",
50
+ "@types/react-dom": "^17.0.8",
63
51
  "@types/blueimp-load-image": "^5.16.0",
64
52
  "@types/lodash": "^4.14.186",
65
53
  "eslint": "^7.16.0",
66
54
  "eslint-plugin-import": "^2.26.0",
67
55
  "esm": "^3.2.25",
56
+ "rimraf": "^5.0.1",
57
+ "typescript": "^4.5.3",
68
58
  "mocha": "^10.0.0"
59
+ },
60
+ "nodemonConfig": {
61
+ "watch": [
62
+ "src"
63
+ ],
64
+ "exec": "pnpm",
65
+ "ext": "js,json,ts,tsx",
66
+ "ignore": [
67
+ "node_modules",
68
+ "dist",
69
+ "build",
70
+ "esm",
71
+ "*.log"
72
+ ],
73
+ "delay": "1",
74
+ "env": {
75
+ "NODE_ENV": "local"
76
+ }
69
77
  }
70
78
  }
@@ -1,11 +0,0 @@
1
- declare const Timer: {
2
- wait: (ms: number) => Promise<unknown>;
3
- };
4
-
5
- declare namespace Timer$1 {
6
- export {
7
- Timer as default,
8
- };
9
- }
10
-
11
- export { Timer$1 as T, Timer as a };
@@ -1,158 +0,0 @@
1
- declare const sumArray: (array: [], key: string) => number;
2
- /**
3
- *
4
- * @param {Array} array
5
- * @param {string} key
6
- * @returns {Number}
7
- */
8
- declare const averageArray: (array: [], key: string) => number;
9
- /**
10
- *
11
- * @param {Array} array
12
- * @param {string} key
13
- * @returns {Number}
14
- */
15
- declare const minArray: (array: [], key: string) => number;
16
- /**
17
- *
18
- * @param {Array} array
19
- * @param {string} key
20
- * @returns {Number}
21
- */
22
- declare const maxArray: (array: [], key: string) => number;
23
- /**
24
- *
25
- * @param {Array} array
26
- * @param {string} key
27
- * @returns {Array}
28
- */
29
- declare const sortElementByString: (array: any, key: string) => any[] | undefined;
30
- /**
31
- *
32
- * @param {Array} array
33
- * @param {string} key
34
- * @returns {Array}
35
- */
36
- declare const sortElementByNumber: (array: any, key: string) => any[] | undefined;
37
- /**
38
- *
39
- * @param {Array} array
40
- * @returns {any}
41
- */
42
- declare const firstElement: (array: any[]) => any;
43
- /**
44
- *
45
- * @param {Array} array
46
- * @returns {any}
47
- */
48
- declare const lastElement: (array: any[]) => any;
49
- /**
50
- *
51
- * @param {Array} array
52
- * @returns {any}
53
- */
54
- declare const randomIndex: (array: any[]) => number;
55
- /**
56
- *
57
- * @param {Array} array
58
- * @returns {any}
59
- */
60
- declare const randomElement: (array: any[]) => any;
61
- /**
62
- * Remove same elements from 2 arrays
63
- */
64
- declare const mergeAndMakeUniqueElement: (list1: any[], list2: any[], key: string) => any[] | undefined;
65
- /**
66
- * check target == toMatch
67
- * @param {Array} target
68
- * @param {Array} toMatch
69
- * @returns {Boolean}
70
- */
71
- declare const allMatchInArray: (target: any[], toMatch: any[]) => boolean;
72
- declare const removeItem: (item: any, array: any[]) => any[];
73
- declare const removeItemByKey: (key: string, value: any, array: any[]) => any[];
74
- declare const getRandom: (array: any[], n?: number) => any[];
75
- /**
76
- * Get an array with shuffle element
77
- */
78
- declare const getHalfRandom: (array: any[], n: number) => any[];
79
- /**
80
- * Make array shuffle itself
81
- */
82
- declare const shuffle: (array: any[]) => any[];
83
- /**
84
- *
85
- * @param {Array} array
86
- * @param {Number} oldIndex
87
- * @param {Number} newIndex
88
- * @returns {Array}
89
- */
90
- declare const moveIndex: (array: any[], oldIndex: number, newIndex: number) => any[];
91
- declare const moveArray: (array: any[], oldIndex: number, newIndex: number) => any[];
92
- declare const xarray: {
93
- sumArray: (array: [], key: string) => number;
94
- averageArray: (array: [], key: string) => number;
95
- minArray: (array: [], key: string) => number;
96
- maxArray: (array: [], key: string) => number;
97
- sortElementByString: (array: any, key: string) => any[] | undefined;
98
- sortElementByNumber: (array: any, key: string) => any[] | undefined;
99
- firstElement: (array: any[]) => any;
100
- lastElement: (array: any[]) => any;
101
- randomIndex: (array: any[]) => number;
102
- randomElement: (array: any[]) => any;
103
- mergeAndMakeUniqueElement: (list1: any[], list2: any[], key: string) => any[] | undefined;
104
- allMatchInArray: (target: any[], toMatch: any[]) => boolean;
105
- removeItem: (item: any, array: any[]) => any[];
106
- removeItemByKey: (key: string, value: any, array: any[]) => any[];
107
- getRandom: (array: any[], n?: number) => any[];
108
- getHalfRandom: (array: any[], n: number) => any[];
109
- shuffle: (array: any[]) => any[];
110
- moveIndex: (array: any[], oldIndex: number, newIndex: number) => any[];
111
- moveArray: (array: any[], oldIndex: number, newIndex: number) => any[];
112
- };
113
-
114
- declare const array_allMatchInArray: typeof allMatchInArray;
115
- declare const array_averageArray: typeof averageArray;
116
- declare const array_firstElement: typeof firstElement;
117
- declare const array_getHalfRandom: typeof getHalfRandom;
118
- declare const array_getRandom: typeof getRandom;
119
- declare const array_lastElement: typeof lastElement;
120
- declare const array_maxArray: typeof maxArray;
121
- declare const array_mergeAndMakeUniqueElement: typeof mergeAndMakeUniqueElement;
122
- declare const array_minArray: typeof minArray;
123
- declare const array_moveArray: typeof moveArray;
124
- declare const array_moveIndex: typeof moveIndex;
125
- declare const array_randomElement: typeof randomElement;
126
- declare const array_randomIndex: typeof randomIndex;
127
- declare const array_removeItem: typeof removeItem;
128
- declare const array_removeItemByKey: typeof removeItemByKey;
129
- declare const array_shuffle: typeof shuffle;
130
- declare const array_sortElementByNumber: typeof sortElementByNumber;
131
- declare const array_sortElementByString: typeof sortElementByString;
132
- declare const array_sumArray: typeof sumArray;
133
- declare namespace array {
134
- export {
135
- array_allMatchInArray as allMatchInArray,
136
- array_averageArray as averageArray,
137
- xarray as default,
138
- array_firstElement as firstElement,
139
- array_getHalfRandom as getHalfRandom,
140
- array_getRandom as getRandom,
141
- array_lastElement as lastElement,
142
- array_maxArray as maxArray,
143
- array_mergeAndMakeUniqueElement as mergeAndMakeUniqueElement,
144
- array_minArray as minArray,
145
- array_moveArray as moveArray,
146
- array_moveIndex as moveIndex,
147
- array_randomElement as randomElement,
148
- array_randomIndex as randomIndex,
149
- array_removeItem as removeItem,
150
- array_removeItemByKey as removeItemByKey,
151
- array_shuffle as shuffle,
152
- array_sortElementByNumber as sortElementByNumber,
153
- array_sortElementByString as sortElementByString,
154
- array_sumArray as sumArray,
155
- };
156
- }
157
-
158
- export { array as a, averageArray as b, maxArray as c, sortElementByString as d, sortElementByNumber as e, firstElement as f, randomElement as g, mergeAndMakeUniqueElement as h, allMatchInArray as i, removeItem as j, removeItemByKey as k, lastElement as l, minArray as m, getRandom as n, getHalfRandom as o, shuffle as p, moveIndex as q, randomIndex as r, sumArray as s, moveArray as t, xarray as x };