diginext-utils 2.0.33 → 2.0.35
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/package.json +1 -1
- package/src/console/index.ts +2 -2
- package/src/string/url.ts +2 -2
- package/dist/Checker.d.ts +0 -9
- package/dist/Checker.js +0 -52
- package/dist/Checker.mjs +0 -29
- package/dist/EventDispatcher.d.ts +0 -13
- package/dist/EventDispatcher.js +0 -77
- package/dist/EventDispatcher.mjs +0 -54
- package/dist/FileUpload.d.ts +0 -12
- package/dist/FileUpload.js +0 -85
- package/dist/FileUpload.mjs +0 -62
- package/dist/Slug.d.ts +0 -10
- package/dist/Slug.js +0 -354
- package/dist/Slug.mjs +0 -331
- package/dist/Timer-7b0c4e7c.d.ts +0 -11
- package/dist/Timer.d.ts +0 -1
- package/dist/Timer.js +0 -33
- package/dist/Timer.mjs +0 -7
- package/dist/Validation.d.ts +0 -6
- package/dist/Validation.js +0 -56
- package/dist/Validation.mjs +0 -35
- package/dist/array-dc599632.d.ts +0 -158
- package/dist/array.d.ts +0 -1
- package/dist/array.js +0 -277
- package/dist/array.mjs +0 -49
- package/dist/browser-8d042ffe.d.ts +0 -22
- package/dist/camera-1a859d72.d.ts +0 -15
- package/dist/chunk-5NTK5JAI.mjs +0 -57
- package/dist/chunk-5UEMANWE.mjs +0 -91
- package/dist/chunk-5ZOWNKSD.mjs +0 -166
- package/dist/chunk-6GNGTFNC.mjs +0 -118
- package/dist/chunk-7MK72U4O.mjs +0 -19
- package/dist/chunk-7XKT3AQX.mjs +0 -17
- package/dist/chunk-7ZCEZM7K.mjs +0 -41
- package/dist/chunk-AMBWJGSW.mjs +0 -151
- package/dist/chunk-C7S43KGB.mjs +0 -15
- package/dist/chunk-CJM7T7ON.mjs +0 -24
- package/dist/chunk-CKILLYAP.mjs +0 -16
- package/dist/chunk-DX7MUT3M.mjs +0 -51
- package/dist/chunk-EGUJQ5VF.mjs +0 -32
- package/dist/chunk-ETEIHDWU.mjs +0 -25
- package/dist/chunk-FJXSVGL7.mjs +0 -22
- package/dist/chunk-GJCAEOND.mjs +0 -20
- package/dist/chunk-GNJDIUYM.mjs +0 -40
- package/dist/chunk-IA7GINWD.mjs +0 -39
- package/dist/chunk-JEI7BOXY.mjs +0 -21
- package/dist/chunk-K4KENOE6.mjs +0 -20
- package/dist/chunk-KMERW6KS.mjs +0 -34
- package/dist/chunk-KPO3RH5G.mjs +0 -27
- package/dist/chunk-KWG5LYNK.mjs +0 -100
- package/dist/chunk-NUTQDHLQ.mjs +0 -40
- package/dist/chunk-O64XUDAH.mjs +0 -35
- package/dist/chunk-OYRPWQUA.mjs +0 -257
- package/dist/chunk-PNZ4KGXL.mjs +0 -56
- package/dist/chunk-QZYX26HT.mjs +0 -24
- package/dist/chunk-RDGP2CKM.mjs +0 -195
- package/dist/chunk-VFG5VU6S.mjs +0 -12
- package/dist/chunk-X3IMFCZG.mjs +0 -23
- package/dist/chunk-ZHNGZMRD.mjs +0 -17
- package/dist/color.d.ts +0 -24
- package/dist/color.js +0 -106
- package/dist/color.mjs +0 -78
- package/dist/console/enableConsole.d.ts +0 -1
- package/dist/console/enableConsole.js +0 -42
- package/dist/console/enableConsole.mjs +0 -9
- package/dist/console/index.d.ts +0 -2
- package/dist/console/index.js +0 -61
- package/dist/console/index.mjs +0 -14
- package/dist/console/log.d.ts +0 -16
- package/dist/console/log.js +0 -75
- package/dist/console/log.mjs +0 -19
- package/dist/createDir-220e0081.d.ts +0 -13
- package/dist/device/browser.d.ts +0 -1
- package/dist/device/browser.js +0 -66
- package/dist/device/browser.mjs +0 -15
- package/dist/device/camera.d.ts +0 -1
- package/dist/device/camera.js +0 -190
- package/dist/device/camera.mjs +0 -8
- package/dist/device/index.d.ts +0 -1
- package/dist/device/index.js +0 -210
- package/dist/device/index.mjs +0 -15
- package/dist/device/os.d.ts +0 -12
- package/dist/device/os.js +0 -65
- package/dist/device/os.mjs +0 -33
- package/dist/enableConsole-ddc24282.d.ts +0 -11
- package/dist/file/createDir.d.ts +0 -1
- package/dist/file/createDir.js +0 -37
- package/dist/file/createDir.mjs +0 -7
- package/dist/file/fileMove.d.ts +0 -1
- package/dist/file/fileMove.js +0 -53
- package/dist/file/fileMove.mjs +0 -7
- package/dist/file/findFilesByExt.d.ts +0 -1
- package/dist/file/findFilesByExt.js +0 -69
- package/dist/file/findFilesByExt.mjs +0 -11
- package/dist/file/index.d.ts +0 -11
- package/dist/file/index.js +0 -106
- package/dist/file/index.mjs +0 -17
- package/dist/fileMove-3a09e429.d.ts +0 -13
- package/dist/findFilesByExt-753e91d7.d.ts +0 -24
- package/dist/images/index.d.ts +0 -2
- package/dist/images/index.js +0 -132
- package/dist/images/index.mjs +0 -15
- package/dist/images/loadImage.d.ts +0 -3
- package/dist/images/loadImage.js +0 -42
- package/dist/images/loadImage.mjs +0 -21
- package/dist/images/resize.d.ts +0 -3
- package/dist/images/resize.js +0 -64
- package/dist/images/resize.mjs +0 -9
- package/dist/images/upload.d.ts +0 -11
- package/dist/images/upload.js +0 -132
- package/dist/images/upload.mjs +0 -14
- package/dist/index-1f738e52.d.ts +0 -22
- package/dist/index-22309f0c.d.ts +0 -23
- package/dist/index-6ae3c86b.d.ts +0 -63
- package/dist/index-c8fffc86.d.ts +0 -90
- package/dist/index-d652ed2c.d.ts +0 -26
- package/dist/index.d.ts +0 -48
- package/dist/index.js +0 -1353
- package/dist/index.mjs +0 -87
- package/dist/json.d.ts +0 -9
- package/dist/json.js +0 -52
- package/dist/json.mjs +0 -29
- package/dist/math/diffDate.d.ts +0 -6
- package/dist/math/diffDate.js +0 -36
- package/dist/math/diffDate.mjs +0 -9
- package/dist/math/index.d.ts +0 -3
- package/dist/math/index.js +0 -160
- package/dist/math/index.mjs +0 -34
- package/dist/math/positiveNumber.d.ts +0 -3
- package/dist/math/positiveNumber.js +0 -56
- package/dist/math/positiveNumber.mjs +0 -10
- package/dist/name/en.d.ts +0 -6
- package/dist/name/en.js +0 -44
- package/dist/name/en.mjs +0 -9
- package/dist/name/index.d.ts +0 -3
- package/dist/name/index.js +0 -88
- package/dist/name/index.mjs +0 -20
- package/dist/name/vi.d.ts +0 -6
- package/dist/name/vi.js +0 -66
- package/dist/name/vi.mjs +0 -14
- package/dist/object-43aaaf92.d.ts +0 -80
- package/dist/object.d.ts +0 -1
- package/dist/object.js +0 -105
- package/dist/object.mjs +0 -21
- package/dist/permission/index.d.ts +0 -9
- package/dist/permission/index.js +0 -231
- package/dist/permission/index.mjs +0 -15
- package/dist/permission/requestCamera.d.ts +0 -1
- package/dist/permission/requestCamera.js +0 -54
- package/dist/permission/requestCamera.mjs +0 -9
- package/dist/permission/requestDeviceOrientationControl.d.ts +0 -1
- package/dist/permission/requestDeviceOrientationControl.js +0 -206
- package/dist/permission/requestDeviceOrientationControl.mjs +0 -10
- package/dist/requestCamera-32b7dfc7.d.ts +0 -14
- package/dist/requestDeviceOrientationControl-b6458660.d.ts +0 -11
- package/dist/response/index.d.ts +0 -50
- package/dist/response/index.js +0 -97
- package/dist/response/index.mjs +0 -16
- package/dist/string/formatNumber.d.ts +0 -7
- package/dist/string/formatNumber.js +0 -56
- package/dist/string/formatNumber.mjs +0 -10
- package/dist/string/generatePassword.d.ts +0 -10
- package/dist/string/generatePassword.js +0 -55
- package/dist/string/generatePassword.mjs +0 -10
- package/dist/string/generateUUID.d.ts +0 -3
- package/dist/string/generateUUID.js +0 -40
- package/dist/string/generateUUID.mjs +0 -9
- package/dist/string/index.d.ts +0 -6
- package/dist/string/index.js +0 -316
- package/dist/string/index.mjs +0 -31
- package/dist/string/makeDaySlug.d.ts +0 -32
- package/dist/string/makeDaySlug.js +0 -47
- package/dist/string/makeDaySlug.mjs +0 -9
- package/dist/string/random.d.ts +0 -15
- package/dist/string/random.js +0 -56
- package/dist/string/random.mjs +0 -19
- package/dist/string/trimNull.d.ts +0 -3
- package/dist/string/trimNull.js +0 -49
- package/dist/string/trimNull.mjs +0 -9
- package/dist/string/url.d.ts +0 -1
- package/dist/string/url.js +0 -126
- package/dist/string/url.mjs +0 -22
- package/dist/url-60657387.d.ts +0 -57
package/dist/chunk-KPO3RH5G.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/string/random.ts
|
|
2
|
-
var textLowCase = "abcdefghijklmnopqrstuvwxyz";
|
|
3
|
-
var numeric = "0123456789";
|
|
4
|
-
var punctuation = "!@#$%^&*()_+~|}{[];?><,./-=";
|
|
5
|
-
var allCharacter = `\u0111\u0110a\xE1\xE0\u1EA3\xE3\u1EA1\u0103\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\xE2\u1EA5\u1EA7\u1EA9\u1EAB\u1EADe\xE9\xE8\u1EBB\u1EBD\u1EB9\xEA\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7o\xF3\xF2\u1ECF\xF5\u1ECD\xF4\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u01A1\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3i\xED\xEC\u1EC9\u0129\u1ECBu\xFA\xF9\u1EE7\u0169\u1EE5\u01B0\u1EE9\u1EEB\u1EED\u1EEF\u1EF1y\xFD\u1EF3\u1EF7\u1EF9\u1EF5A\xC1\xC0\u1EA2\xC3\u1EA0\u0102\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\xC2\u1EA4\u1EA6\u1EA8\u1EAA\u1EACE\xC9\xC8\u1EBA\u1EBC\u1EB8\xCA\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6O\xD3\xD2\u1ECE\xD5\u1ECC\xD4\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u01A0\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2I\xCD\xCC\u1EC8\u0128\u1ECAU\xDA\xD9\u1EE6\u0168\u1EE4\u01AF\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0Y\xDD\u1EF2 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_\`abcdefghijklmnopqrstuvwxyz{|}`;
|
|
6
|
-
var randAllCharacterByLength = (length = 0) => {
|
|
7
|
-
return randomStringByLength(length, allCharacter);
|
|
8
|
-
};
|
|
9
|
-
var randomStringByLength = (length, str = textLowCase) => {
|
|
10
|
-
let result = "";
|
|
11
|
-
for (let i = 0; i < length; i++) {
|
|
12
|
-
result += str.charAt(Math.floor(Math.random() * str.length));
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
var random = { randAllCharacterByLength, randomStringByLength };
|
|
17
|
-
var random_default = random;
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
textLowCase,
|
|
21
|
-
numeric,
|
|
22
|
-
punctuation,
|
|
23
|
-
allCharacter,
|
|
24
|
-
randAllCharacterByLength,
|
|
25
|
-
randomStringByLength,
|
|
26
|
-
random_default
|
|
27
|
-
};
|
package/dist/chunk-KWG5LYNK.mjs
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isNull
|
|
3
|
-
} from "./chunk-5UEMANWE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__export
|
|
6
|
-
} from "./chunk-ZHNGZMRD.mjs";
|
|
7
|
-
|
|
8
|
-
// src/string/url.ts
|
|
9
|
-
var url_exports = {};
|
|
10
|
-
__export(url_exports, {
|
|
11
|
-
addQueryParam: () => addQueryParam,
|
|
12
|
-
default: () => url_default,
|
|
13
|
-
getFileExtension: () => getFileExtension,
|
|
14
|
-
getFileNameWithExtension: () => getFileNameWithExtension,
|
|
15
|
-
getFileNameWithoutExtension: () => getFileNameWithoutExtension,
|
|
16
|
-
getUrlParams: () => getUrlParams,
|
|
17
|
-
isImage: () => isImage,
|
|
18
|
-
isLink: () => isLink
|
|
19
|
-
});
|
|
20
|
-
var urlRegex = /(https?:\/\/[^\s]+)/g;
|
|
21
|
-
var addQueryParam = (_url, key, value) => {
|
|
22
|
-
_url += (_url.split("?")[1] ? "&" : "?") + `${key}=${value}`;
|
|
23
|
-
return _url;
|
|
24
|
-
};
|
|
25
|
-
var getUrlParams = (parameter, staticURL, decode = true) => {
|
|
26
|
-
if (typeof window == "undefined")
|
|
27
|
-
return "";
|
|
28
|
-
staticURL = staticURL == void 0 ? window.location.host : staticURL;
|
|
29
|
-
var currLocation = staticURL.length > 0 ? staticURL : window.location.search;
|
|
30
|
-
if (currLocation.split("?").length < 2)
|
|
31
|
-
return "";
|
|
32
|
-
var parArr = currLocation.split("?")[1].split("&"), returnBool = true;
|
|
33
|
-
for (var i = 0; i < parArr.length; i++) {
|
|
34
|
-
var parr = parArr[i].split("=");
|
|
35
|
-
if (parr[0] == parameter) {
|
|
36
|
-
return decode ? decodeURIComponent(parr[1]) : parr[1];
|
|
37
|
-
returnBool = true;
|
|
38
|
-
} else {
|
|
39
|
-
returnBool = false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (!returnBool)
|
|
43
|
-
return false;
|
|
44
|
-
};
|
|
45
|
-
var isLink = (str) => {
|
|
46
|
-
return urlRegex.test(str);
|
|
47
|
-
};
|
|
48
|
-
var getFileNameWithoutExtension = (url) => {
|
|
49
|
-
url = decodeURIComponent(url);
|
|
50
|
-
if (url) {
|
|
51
|
-
const m = url.toString().match(/.*\/(.+?)\./);
|
|
52
|
-
if (m && m.length > 1) {
|
|
53
|
-
return m[1];
|
|
54
|
-
}
|
|
55
|
-
if (!isNull(url)) {
|
|
56
|
-
return url.split(".").shift();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return "";
|
|
60
|
-
};
|
|
61
|
-
var getFileNameWithExtension = (url) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
const _url = decodeURIComponent(url);
|
|
64
|
-
const m = _url.toString().match(/.*\/(.*)$/) || [];
|
|
65
|
-
if (typeof m != "undefined" && (m == null ? void 0 : m.length) > 1) {
|
|
66
|
-
const a = ((_a = m == null ? void 0 : m[1].split("/")) == null ? void 0 : _a.pop()) || "";
|
|
67
|
-
const b = (_b = a.split("?")) == null ? void 0 : _b.shift();
|
|
68
|
-
return b || (m == null ? void 0 : m[1]) || "";
|
|
69
|
-
}
|
|
70
|
-
if (!isNull(_url))
|
|
71
|
-
return url;
|
|
72
|
-
return "";
|
|
73
|
-
};
|
|
74
|
-
var getFileExtension = (url) => {
|
|
75
|
-
return getFileNameWithExtension(url).split(".").pop();
|
|
76
|
-
};
|
|
77
|
-
var isImage = (url) => {
|
|
78
|
-
if (!url)
|
|
79
|
-
return false;
|
|
80
|
-
const arr = ["png", "jpg", "jpeg", "jpe", "jif", "jfif", "gif", "svg"];
|
|
81
|
-
const index = arr.findIndex((item) => {
|
|
82
|
-
var _a;
|
|
83
|
-
return ((_a = getFileExtension(url)) == null ? void 0 : _a.toLowerCase()) == item;
|
|
84
|
-
});
|
|
85
|
-
return index >= 0;
|
|
86
|
-
};
|
|
87
|
-
var xurl = { addQueryParam, getUrlParams, isLink, getFileNameWithoutExtension, getFileNameWithExtension, getFileExtension, isImage };
|
|
88
|
-
var url_default = xurl;
|
|
89
|
-
|
|
90
|
-
export {
|
|
91
|
-
addQueryParam,
|
|
92
|
-
getUrlParams,
|
|
93
|
-
isLink,
|
|
94
|
-
getFileNameWithoutExtension,
|
|
95
|
-
getFileNameWithExtension,
|
|
96
|
-
getFileExtension,
|
|
97
|
-
isImage,
|
|
98
|
-
url_default,
|
|
99
|
-
url_exports
|
|
100
|
-
};
|
package/dist/chunk-NUTQDHLQ.mjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-ZHNGZMRD.mjs";
|
|
4
|
-
|
|
5
|
-
// src/permission/requestCamera.ts
|
|
6
|
-
var requestCamera_exports = {};
|
|
7
|
-
__export(requestCamera_exports, {
|
|
8
|
-
default: () => requestCamera_default,
|
|
9
|
-
requestCamera: () => requestCamera
|
|
10
|
-
});
|
|
11
|
-
var requestCamera = ({ audio = true, video = true }) => {
|
|
12
|
-
if (typeof window == "undefined")
|
|
13
|
-
return false;
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
if (navigator.mediaDevices.getUserMedia === void 0) {
|
|
16
|
-
navigator.mediaDevices.getUserMedia = function(constraints) {
|
|
17
|
-
var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
|
18
|
-
if (!getUserMedia) {
|
|
19
|
-
return Promise.reject(new Error("getUserMedia is not implemented in this browser"));
|
|
20
|
-
}
|
|
21
|
-
return new Promise(function(resolve2, reject2) {
|
|
22
|
-
getUserMedia.call(navigator, constraints, resolve2, reject2);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
navigator.mediaDevices.getUserMedia({ audio, video }).then(function(stream) {
|
|
27
|
-
resolve(true);
|
|
28
|
-
}).catch(function(err) {
|
|
29
|
-
console.log(err.name + ": " + err.message);
|
|
30
|
-
resolve(false);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var requestCamera_default = requestCamera;
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
requestCamera,
|
|
38
|
-
requestCamera_default,
|
|
39
|
-
requestCamera_exports
|
|
40
|
-
};
|
package/dist/chunk-O64XUDAH.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
enableConsole
|
|
3
|
-
} from "./chunk-FJXSVGL7.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__export
|
|
6
|
-
} from "./chunk-ZHNGZMRD.mjs";
|
|
7
|
-
|
|
8
|
-
// src/console/index.ts
|
|
9
|
-
var console_exports = {};
|
|
10
|
-
__export(console_exports, {
|
|
11
|
-
default: () => console_default,
|
|
12
|
-
disableConsole: () => disableConsole,
|
|
13
|
-
removeConsole: () => removeConsole,
|
|
14
|
-
showCredit: () => showCredit
|
|
15
|
-
});
|
|
16
|
-
var disableConsole = (params) => {
|
|
17
|
-
for (var key in console) {
|
|
18
|
-
console[key] = function() {
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var removeConsole = disableConsole;
|
|
23
|
-
var showCredit = (params) => {
|
|
24
|
-
console.log("Developed by Digitop | https://www.wearetopgroup.com/?utm_src=console");
|
|
25
|
-
};
|
|
26
|
-
var xconsole = { enableConsole, disableConsole, removeConsole, showCredit };
|
|
27
|
-
var console_default = xconsole;
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
disableConsole,
|
|
31
|
-
removeConsole,
|
|
32
|
-
showCredit,
|
|
33
|
-
console_default,
|
|
34
|
-
console_exports
|
|
35
|
-
};
|
package/dist/chunk-OYRPWQUA.mjs
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
randInt
|
|
3
|
-
} from "./chunk-6GNGTFNC.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__export
|
|
6
|
-
} from "./chunk-ZHNGZMRD.mjs";
|
|
7
|
-
|
|
8
|
-
// src/array.ts
|
|
9
|
-
var array_exports = {};
|
|
10
|
-
__export(array_exports, {
|
|
11
|
-
allMatchInArray: () => allMatchInArray,
|
|
12
|
-
averageArray: () => averageArray,
|
|
13
|
-
default: () => array_default,
|
|
14
|
-
firstElement: () => firstElement,
|
|
15
|
-
getHalfRandom: () => getHalfRandom,
|
|
16
|
-
getRandom: () => getRandom,
|
|
17
|
-
lastElement: () => lastElement,
|
|
18
|
-
maxArray: () => maxArray,
|
|
19
|
-
mergeAndMakeUniqueElement: () => mergeAndMakeUniqueElement,
|
|
20
|
-
minArray: () => minArray,
|
|
21
|
-
moveArray: () => moveArray,
|
|
22
|
-
moveIndex: () => moveIndex,
|
|
23
|
-
randomElement: () => randomElement,
|
|
24
|
-
randomIndex: () => randomIndex,
|
|
25
|
-
removeItem: () => removeItem,
|
|
26
|
-
removeItemByKey: () => removeItemByKey,
|
|
27
|
-
shuffle: () => shuffle,
|
|
28
|
-
sortElementByNumber: () => sortElementByNumber,
|
|
29
|
-
sortElementByString: () => sortElementByString,
|
|
30
|
-
sumArray: () => sumArray
|
|
31
|
-
});
|
|
32
|
-
var sumArray = (array, key) => {
|
|
33
|
-
if (!array) {
|
|
34
|
-
console.warn("ARRAY NOT EXITED !");
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
if (key)
|
|
38
|
-
return array.reduce((c, v) => c + v[key], 0);
|
|
39
|
-
else
|
|
40
|
-
return array.reduce((c, v) => c + v, 0);
|
|
41
|
-
};
|
|
42
|
-
var averageArray = (array, key) => {
|
|
43
|
-
if (!array) {
|
|
44
|
-
console.warn("ARRAY NOT EXITED !");
|
|
45
|
-
return 0;
|
|
46
|
-
}
|
|
47
|
-
return sumArray(array, key) / array.length || 0;
|
|
48
|
-
};
|
|
49
|
-
var minArray = (array, key) => {
|
|
50
|
-
if (!array) {
|
|
51
|
-
console.warn("ARRAY NOT EXITED !");
|
|
52
|
-
return 0;
|
|
53
|
-
}
|
|
54
|
-
if (array.length > 0) {
|
|
55
|
-
if (key)
|
|
56
|
-
return array.reduce((c, v) => c < v[key] ? c : v[key]);
|
|
57
|
-
else
|
|
58
|
-
return array.reduce((c, v) => c < v ? c : v);
|
|
59
|
-
}
|
|
60
|
-
return 0;
|
|
61
|
-
};
|
|
62
|
-
var maxArray = (array, key) => {
|
|
63
|
-
if (!array) {
|
|
64
|
-
console.warn("ARRAY NOT EXITED !");
|
|
65
|
-
return 0;
|
|
66
|
-
}
|
|
67
|
-
if (array.length > 0) {
|
|
68
|
-
if (key)
|
|
69
|
-
return array.reduce((c, v) => c > v[key] ? c : v[key]);
|
|
70
|
-
else
|
|
71
|
-
return array.reduce((c, v) => c > v ? c : v);
|
|
72
|
-
}
|
|
73
|
-
return 0;
|
|
74
|
-
};
|
|
75
|
-
var sortElementByString = (array, key) => {
|
|
76
|
-
if (!Array.isArray(array))
|
|
77
|
-
return [];
|
|
78
|
-
if (key)
|
|
79
|
-
return array.sort((x, y) => {
|
|
80
|
-
var a = x[key].toUpperCase(), b = y[key].toUpperCase();
|
|
81
|
-
return a == b ? 0 : a > b ? 1 : -1;
|
|
82
|
-
});
|
|
83
|
-
console.log("NO KEY");
|
|
84
|
-
};
|
|
85
|
-
var sortElementByNumber = (array, key) => {
|
|
86
|
-
if (!Array.isArray(array))
|
|
87
|
-
return [];
|
|
88
|
-
if (key)
|
|
89
|
-
return array.sort((a, b) => {
|
|
90
|
-
return a[key] - b[key];
|
|
91
|
-
});
|
|
92
|
-
console.log("NO KEY");
|
|
93
|
-
};
|
|
94
|
-
var firstElement = (array) => {
|
|
95
|
-
if (array) {
|
|
96
|
-
if (array.length || array.length > 0)
|
|
97
|
-
return array[0];
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
};
|
|
101
|
-
var lastElement = (array) => {
|
|
102
|
-
if (array) {
|
|
103
|
-
if (array.length || array.length > 0)
|
|
104
|
-
return array[array.length - 1];
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
};
|
|
108
|
-
var randomIndex = (array) => {
|
|
109
|
-
if (array)
|
|
110
|
-
return randInt(0, array.length - 1);
|
|
111
|
-
return -1;
|
|
112
|
-
};
|
|
113
|
-
var randomElement = (array) => {
|
|
114
|
-
if (array)
|
|
115
|
-
return array[randomIndex(array)];
|
|
116
|
-
return null;
|
|
117
|
-
};
|
|
118
|
-
var mergeAndMakeUniqueElement = (list1, list2, key) => {
|
|
119
|
-
if (!list1 || !list2)
|
|
120
|
-
return;
|
|
121
|
-
if (key) {
|
|
122
|
-
return list1.concat(list2).filter((item, index, self) => {
|
|
123
|
-
return self.findIndex((x) => x[key] == item[key]) === index;
|
|
124
|
-
});
|
|
125
|
-
} else {
|
|
126
|
-
return list1.concat(list2).filter((x, index, self) => {
|
|
127
|
-
return self.indexOf(x) === index;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
var allMatchInArray = (target, toMatch) => {
|
|
132
|
-
if (!target || !toMatch)
|
|
133
|
-
return false;
|
|
134
|
-
const found = toMatch.every((item) => {
|
|
135
|
-
return target.includes(item);
|
|
136
|
-
});
|
|
137
|
-
return found;
|
|
138
|
-
};
|
|
139
|
-
var removeItem = (item, array) => {
|
|
140
|
-
const index = array.indexOf(item);
|
|
141
|
-
if (index == -1) {
|
|
142
|
-
console.warn("[ArrayExtra.removeItem] Item not found.");
|
|
143
|
-
return array;
|
|
144
|
-
}
|
|
145
|
-
array.splice(index, 1);
|
|
146
|
-
return array;
|
|
147
|
-
};
|
|
148
|
-
var removeItemByKey = (key, value, array) => {
|
|
149
|
-
const foundIndex = array.findIndex((item) => {
|
|
150
|
-
return item[key] == value;
|
|
151
|
-
});
|
|
152
|
-
if (foundIndex < 0) {
|
|
153
|
-
console.warn("[ArrayExtra.removeItemByKey] Item not found.", key, value);
|
|
154
|
-
return array;
|
|
155
|
-
}
|
|
156
|
-
array.splice(foundIndex, 1);
|
|
157
|
-
return array;
|
|
158
|
-
};
|
|
159
|
-
var getRandom = (array, n) => {
|
|
160
|
-
var result = new Array(n), len = array.length, taken = new Array(len);
|
|
161
|
-
if (n > len)
|
|
162
|
-
throw new RangeError("getRandom: more elements taken than available");
|
|
163
|
-
while (n--) {
|
|
164
|
-
var x = Math.floor(Math.random() * len);
|
|
165
|
-
result[n] = array[x in taken ? taken[x] : x];
|
|
166
|
-
taken[x] = --len in taken ? taken[len] : len;
|
|
167
|
-
}
|
|
168
|
-
return result;
|
|
169
|
-
};
|
|
170
|
-
var getHalfRandom = (array, n) => {
|
|
171
|
-
var n = Math.ceil(array.length / 2);
|
|
172
|
-
return getRandom(array, n);
|
|
173
|
-
};
|
|
174
|
-
var shuffle = (array) => {
|
|
175
|
-
var i = array.length, j, temp;
|
|
176
|
-
if (array.length < 1)
|
|
177
|
-
return array;
|
|
178
|
-
while (--i) {
|
|
179
|
-
j = Math.floor(Math.random() * (i + 1));
|
|
180
|
-
temp = array[i];
|
|
181
|
-
array[i] = array[j];
|
|
182
|
-
array[j] = temp;
|
|
183
|
-
}
|
|
184
|
-
return array;
|
|
185
|
-
};
|
|
186
|
-
var moveIndex = (array, oldIndex, newIndex) => {
|
|
187
|
-
if (newIndex >= array.length) {
|
|
188
|
-
var k = newIndex - array.length + 1;
|
|
189
|
-
while (k--) {
|
|
190
|
-
array.push(void 0);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
array.splice(newIndex, 0, array.splice(oldIndex, 1)[0]);
|
|
194
|
-
return array;
|
|
195
|
-
};
|
|
196
|
-
var moveArray = (array, oldIndex, newIndex) => {
|
|
197
|
-
while (oldIndex < 0) {
|
|
198
|
-
oldIndex += array.length;
|
|
199
|
-
}
|
|
200
|
-
while (newIndex < 0) {
|
|
201
|
-
newIndex += array.length;
|
|
202
|
-
}
|
|
203
|
-
if (newIndex >= array.length) {
|
|
204
|
-
var k = newIndex - array.length;
|
|
205
|
-
while (k-- + 1) {
|
|
206
|
-
array.push(999);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
array.splice(newIndex, 0, array.splice(oldIndex, 1)[0]);
|
|
210
|
-
return array;
|
|
211
|
-
};
|
|
212
|
-
var xarray = {
|
|
213
|
-
sumArray,
|
|
214
|
-
averageArray,
|
|
215
|
-
minArray,
|
|
216
|
-
maxArray,
|
|
217
|
-
sortElementByString,
|
|
218
|
-
sortElementByNumber,
|
|
219
|
-
firstElement,
|
|
220
|
-
lastElement,
|
|
221
|
-
randomIndex,
|
|
222
|
-
randomElement,
|
|
223
|
-
mergeAndMakeUniqueElement,
|
|
224
|
-
allMatchInArray,
|
|
225
|
-
removeItem,
|
|
226
|
-
removeItemByKey,
|
|
227
|
-
getRandom,
|
|
228
|
-
getHalfRandom,
|
|
229
|
-
shuffle,
|
|
230
|
-
moveIndex,
|
|
231
|
-
moveArray
|
|
232
|
-
};
|
|
233
|
-
var array_default = xarray;
|
|
234
|
-
|
|
235
|
-
export {
|
|
236
|
-
sumArray,
|
|
237
|
-
averageArray,
|
|
238
|
-
minArray,
|
|
239
|
-
maxArray,
|
|
240
|
-
sortElementByString,
|
|
241
|
-
sortElementByNumber,
|
|
242
|
-
firstElement,
|
|
243
|
-
lastElement,
|
|
244
|
-
randomIndex,
|
|
245
|
-
randomElement,
|
|
246
|
-
mergeAndMakeUniqueElement,
|
|
247
|
-
allMatchInArray,
|
|
248
|
-
removeItem,
|
|
249
|
-
removeItemByKey,
|
|
250
|
-
getRandom,
|
|
251
|
-
getHalfRandom,
|
|
252
|
-
shuffle,
|
|
253
|
-
moveIndex,
|
|
254
|
-
moveArray,
|
|
255
|
-
array_default,
|
|
256
|
-
array_exports
|
|
257
|
-
};
|
package/dist/chunk-PNZ4KGXL.mjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export,
|
|
3
|
-
__require
|
|
4
|
-
} from "./chunk-ZHNGZMRD.mjs";
|
|
5
|
-
|
|
6
|
-
// src/file/findFilesByExt.ts
|
|
7
|
-
var findFilesByExt_exports = {};
|
|
8
|
-
__export(findFilesByExt_exports, {
|
|
9
|
-
default: () => findFilesByExt_default,
|
|
10
|
-
findFileByExt: () => findFileByExt,
|
|
11
|
-
forEachFileByExt: () => forEachFileByExt
|
|
12
|
-
});
|
|
13
|
-
var path = __require("path");
|
|
14
|
-
var fs = __require("fs");
|
|
15
|
-
var forEachFileByExt = (base, ext, cb) => {
|
|
16
|
-
var walk = function(directoryName) {
|
|
17
|
-
try {
|
|
18
|
-
fs.readdir(directoryName, function(e, files) {
|
|
19
|
-
if (e) {
|
|
20
|
-
console.log("Error: ", e);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
files.forEach(function(file) {
|
|
24
|
-
var fullPath = path.join(directoryName, file);
|
|
25
|
-
fs.stat(fullPath, function(e2, f) {
|
|
26
|
-
if (e2) {
|
|
27
|
-
console.log("Error: ", e2);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (f.isDirectory()) {
|
|
31
|
-
walk(fullPath);
|
|
32
|
-
} else {
|
|
33
|
-
if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
|
|
34
|
-
if (cb)
|
|
35
|
-
cb(fullPath);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.log("error", error);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
walk(base);
|
|
46
|
-
};
|
|
47
|
-
var findFileByExt = forEachFileByExt;
|
|
48
|
-
var fileExt = { findFileByExt, forEachFileByExt };
|
|
49
|
-
var findFilesByExt_default = fileExt;
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
forEachFileByExt,
|
|
53
|
-
findFileByExt,
|
|
54
|
-
findFilesByExt_default,
|
|
55
|
-
findFilesByExt_exports
|
|
56
|
-
};
|
package/dist/chunk-QZYX26HT.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
numeric,
|
|
3
|
-
punctuation,
|
|
4
|
-
randomStringByLength,
|
|
5
|
-
textLowCase
|
|
6
|
-
} from "./chunk-KPO3RH5G.mjs";
|
|
7
|
-
|
|
8
|
-
// src/string/generatePassword.ts
|
|
9
|
-
function generatePassword(length = 6, hard = true) {
|
|
10
|
-
if (!Number.isFinite(length))
|
|
11
|
-
length = 6;
|
|
12
|
-
if (length <= 0)
|
|
13
|
-
length = 6;
|
|
14
|
-
let pass = randomStringByLength(length, textLowCase + textLowCase.toUpperCase() + numeric);
|
|
15
|
-
if (hard)
|
|
16
|
-
pass = pass.replace(pass[Math.floor(pass.length / 2)], randomStringByLength(1, punctuation));
|
|
17
|
-
return pass;
|
|
18
|
-
}
|
|
19
|
-
var generatePassword_default = generatePassword;
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
generatePassword,
|
|
23
|
-
generatePassword_default
|
|
24
|
-
};
|