diginext-utils 1.2.3 → 2.0.0
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.
- package/dist/index.d.ts +280 -0
- package/dist/index.js +867 -146
- package/dist/index.mjs +820 -0
- package/package.json +23 -29
- package/dist/Checker.js +0 -34
- package/dist/EventDispatcher.js +0 -62
- package/dist/FileUpload.js +0 -73
- package/dist/Slug.js +0 -384
- package/dist/Timer.js +0 -16
- package/dist/Validation.js +0 -46
- package/dist/array.js +0 -377
- package/dist/backend/file/createDir.js +0 -24
- package/dist/backend/file/fileMove.js +0 -42
- package/dist/backend/file/findFilesByExt.js +0 -55
- package/dist/backend/zip/extractZip.js +0 -55
- package/dist/color.js +0 -108
- package/dist/console/enableConsole.js +0 -16
- package/dist/console/index.js +0 -20
- package/dist/device/browser.js +0 -52
- package/dist/device/camera.js +0 -238
- package/dist/device.js +0 -304
- package/dist/math/diffDate.js +0 -18
- package/dist/math/positiveNumber.js +0 -16
- package/dist/math.js +0 -230
- package/dist/object.js +0 -80
- package/dist/permission/requestCamera.js +0 -55
- package/dist/permission/requestDeviceOrientationControl.js +0 -36
- package/dist/string/formatNumber.js +0 -24
- package/dist/string/generatePassword.js +0 -29
- package/dist/string/generateUUID.js +0 -19
- package/dist/string/name/en.js +0 -28
- package/dist/string/name/vi.js +0 -37
- package/dist/string/random.js +0 -46
- package/dist/string/trimNull.js +0 -27
- package/dist/string/url.js +0 -151
- package/dist/string.js +0 -476
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
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[];
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {Array} array
|
|
33
|
+
* @param {string} key
|
|
34
|
+
* @returns {Array}
|
|
35
|
+
*/
|
|
36
|
+
declare const sortElementByNumber: (array: any, key: string) => any[];
|
|
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[];
|
|
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
|
+
|
|
93
|
+
declare const isIos: () => boolean;
|
|
94
|
+
declare const isAndroid: () => boolean;
|
|
95
|
+
declare const isMobile: () => boolean;
|
|
96
|
+
declare const checkOS: () => any;
|
|
97
|
+
|
|
98
|
+
declare const disableConsole: (params: any) => void;
|
|
99
|
+
declare const removeConsole: (params: any) => void;
|
|
100
|
+
declare const showCredit: (params: any) => void;
|
|
101
|
+
|
|
102
|
+
declare const isPotrait: () => boolean;
|
|
103
|
+
declare const isLandscape: () => boolean;
|
|
104
|
+
declare const ua: () => any;
|
|
105
|
+
declare const isFacebookWebview: () => boolean;
|
|
106
|
+
declare const isInAppWebview: () => boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @param {{
|
|
111
|
+
* container,
|
|
112
|
+
* facingMode : environment | user,
|
|
113
|
+
* audio : boolean,
|
|
114
|
+
* }} param0
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
declare function getWebcam({ container, facingMode, audio, }: {
|
|
118
|
+
container: any;
|
|
119
|
+
facingMode?: string;
|
|
120
|
+
audio?: boolean;
|
|
121
|
+
}): Promise<unknown>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @param {Number} number
|
|
126
|
+
* @return {Number}
|
|
127
|
+
*/
|
|
128
|
+
declare const randRound: (number: number) => number;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param {Number} number
|
|
132
|
+
* @return {Number}
|
|
133
|
+
*/
|
|
134
|
+
declare const rand: (number: number) => number;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @param {Number} number
|
|
138
|
+
* @return {Number}
|
|
139
|
+
*/
|
|
140
|
+
declare const randHalt: (number: number) => number;
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param {Number} low
|
|
144
|
+
* @param {Number} high
|
|
145
|
+
* @return {Number}
|
|
146
|
+
*/
|
|
147
|
+
declare const randInt: (low: number, high: number) => number;
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @param {Number} low
|
|
151
|
+
* @param {Number} high
|
|
152
|
+
* @return {Number}
|
|
153
|
+
*/
|
|
154
|
+
declare const randFloat: (low: number, high: number) => number;
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* @param {Number} degrees
|
|
158
|
+
* @return {Number}
|
|
159
|
+
*/
|
|
160
|
+
declare const degToRad: (degrees: number) => number;
|
|
161
|
+
/**
|
|
162
|
+
*
|
|
163
|
+
* @param {Number} degrees
|
|
164
|
+
* @return {Number}
|
|
165
|
+
*/
|
|
166
|
+
declare const radToDeg: (radians: number) => number;
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
* @param {Number} cx
|
|
170
|
+
* @param {Number} cy
|
|
171
|
+
* @param {Number} ex
|
|
172
|
+
* @param {Number} ey
|
|
173
|
+
* @returns {Number}
|
|
174
|
+
*/
|
|
175
|
+
declare const angleBetweenPoints: (cx: number, cy: number, ex: number, ey: number) => number;
|
|
176
|
+
|
|
177
|
+
declare const isNull: (object: string | number | {
|
|
178
|
+
[key: string]: any;
|
|
179
|
+
}) => boolean;
|
|
180
|
+
declare const toBool: (object: string | {
|
|
181
|
+
[key: string]: any;
|
|
182
|
+
}) => boolean;
|
|
183
|
+
declare const toInt: (object: string | number | {
|
|
184
|
+
[key: string]: any;
|
|
185
|
+
}) => number;
|
|
186
|
+
declare const toFloat: (object: string | {
|
|
187
|
+
[key: string]: any;
|
|
188
|
+
}) => number;
|
|
189
|
+
declare const toArray: (obj: {
|
|
190
|
+
[key: string]: any;
|
|
191
|
+
}) => {
|
|
192
|
+
[key: string]: any;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Convert value in object to array
|
|
196
|
+
*/
|
|
197
|
+
declare const objectToArray: (obj: {
|
|
198
|
+
[key: string]: any;
|
|
199
|
+
}) => any[];
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Get string between str1 and str2 from text
|
|
203
|
+
*/
|
|
204
|
+
declare const getBetween: (text: string, str1: string, str2?: string) => string;
|
|
205
|
+
/**
|
|
206
|
+
* Convert object to string
|
|
207
|
+
*/
|
|
208
|
+
declare const makeString: (object?: any) => string;
|
|
209
|
+
/**
|
|
210
|
+
* toUpperCase
|
|
211
|
+
*/
|
|
212
|
+
declare const toUpperCase: (str?: string) => string;
|
|
213
|
+
/**
|
|
214
|
+
* toLowerCase
|
|
215
|
+
*/
|
|
216
|
+
declare const toLowerCase: (str?: string) => string;
|
|
217
|
+
/**
|
|
218
|
+
* toLowerCase
|
|
219
|
+
* @param {*} str
|
|
220
|
+
* @return {string}
|
|
221
|
+
*/
|
|
222
|
+
declare const titleize: (str?: string) => string;
|
|
223
|
+
/**
|
|
224
|
+
* Convert only first charater to UpperCase
|
|
225
|
+
*/
|
|
226
|
+
declare const capitalize: (str: string | any, lowercaseRest?: number) => any;
|
|
227
|
+
/**
|
|
228
|
+
* Convert first character from every single words to UpperCase
|
|
229
|
+
*/
|
|
230
|
+
declare const capitalizeName: (str: string) => string;
|
|
231
|
+
declare const clearUnicodeCharacters: (s: string, opt?: {
|
|
232
|
+
[key: string]: any;
|
|
233
|
+
}) => string;
|
|
234
|
+
|
|
235
|
+
declare const addQueryParam: (_url: string, key: string, value: any) => string;
|
|
236
|
+
declare const getUrlParams: (parameter: string, staticURL?: string, decode?: boolean) => string | false;
|
|
237
|
+
/**
|
|
238
|
+
*
|
|
239
|
+
* @return {boolean}
|
|
240
|
+
*/
|
|
241
|
+
declare const isLink: (str: string) => boolean;
|
|
242
|
+
/**
|
|
243
|
+
*
|
|
244
|
+
* @param {string} url
|
|
245
|
+
* @return {string}
|
|
246
|
+
*/
|
|
247
|
+
declare const getFileNameWithoutExtension: (url: string) => string;
|
|
248
|
+
/**
|
|
249
|
+
*
|
|
250
|
+
* @param {string} url
|
|
251
|
+
* @return {string}
|
|
252
|
+
*/
|
|
253
|
+
declare const getFileNameWithExtension: (url: string) => string;
|
|
254
|
+
/**
|
|
255
|
+
*
|
|
256
|
+
* @param {string} url
|
|
257
|
+
* @return {string}
|
|
258
|
+
*/
|
|
259
|
+
declare const getFileExtension: (url: string) => string;
|
|
260
|
+
/**
|
|
261
|
+
*
|
|
262
|
+
* @param {string} url
|
|
263
|
+
* @returns
|
|
264
|
+
*/
|
|
265
|
+
declare const isImage: (url: string) => boolean;
|
|
266
|
+
|
|
267
|
+
declare const Timer: {
|
|
268
|
+
wait: (ms: number) => Promise<unknown>;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
declare const requestCamera: ({ audio, video }: {
|
|
272
|
+
audio?: boolean;
|
|
273
|
+
video?: boolean;
|
|
274
|
+
}) => false | Promise<unknown>;
|
|
275
|
+
|
|
276
|
+
declare const requestDeviceOrientationControl: () => false | Promise<unknown>;
|
|
277
|
+
|
|
278
|
+
declare function enableConsole(): Console;
|
|
279
|
+
|
|
280
|
+
export { Timer, addQueryParam, allMatchInArray, angleBetweenPoints, averageArray, capitalize, capitalizeName, checkOS, clearUnicodeCharacters, degToRad, disableConsole, enableConsole, firstElement, getBetween, getFileExtension, getFileNameWithExtension, getFileNameWithoutExtension, getHalfRandom, getRandom, getUrlParams, getWebcam, isAndroid, isFacebookWebview, isImage, isInAppWebview, isIos, isLandscape, isLink, isMobile, isNull, isPotrait, lastElement, makeString, maxArray, mergeAndMakeUniqueElement, minArray, moveArray, moveIndex, objectToArray, radToDeg, rand, randFloat, randHalt, randInt, randRound, randomElement, randomIndex, removeConsole, removeItem, removeItemByKey, requestCamera, requestDeviceOrientationControl, showCredit, shuffle, sortElementByNumber, sortElementByString, sumArray, titleize, toArray, toBool, toFloat, toInt, toLowerCase, toUpperCase, ua };
|