@rzl-zone/utils-js 3.5.3 → 3.5.4
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/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +1 -1
- package/dist/assertions/index.js +5 -5
- package/dist/{chunk-RZW35UN5.cjs → chunk-2CQI36UD.cjs} +6 -6
- package/dist/{chunk-CDCERIZ2.js → chunk-2RZGZEE2.js} +3 -3
- package/dist/{chunk-PET42Z7W.js → chunk-2VO2CBTU.js} +2 -2
- package/dist/{chunk-CMW2TBOQ.js → chunk-3KTD3QDI.js} +2 -7
- package/dist/{chunk-XEDXFSGI.js → chunk-4ACKNPL5.js} +2 -2
- package/dist/{chunk-SIM77PU4.js → chunk-4ZOXSUXB.js} +3 -3
- package/dist/{chunk-IVL7CKVH.cjs → chunk-5NN4ZDE2.cjs} +6 -6
- package/dist/{chunk-FJZGG54N.cjs → chunk-66WLOZOD.cjs} +50 -50
- package/dist/{chunk-SBFNXGTJ.js → chunk-6DSPJA5U.js} +9 -9
- package/dist/{chunk-D3ENH7H6.cjs → chunk-6RFNZ2ZZ.cjs} +14 -14
- package/dist/{chunk-CKTLUNWX.js → chunk-6WMB5AJR.js} +2 -2
- package/dist/{chunk-JBQMXC5I.cjs → chunk-7QQV66RX.cjs} +10 -10
- package/dist/{chunk-6JFZL7YE.cjs → chunk-7WBMA2VE.cjs} +4 -4
- package/dist/{chunk-3IBQ5MOM.js → chunk-7ZNEUWYP.js} +2 -2
- package/dist/{chunk-JEQEF5WD.js → chunk-A3YI6Y2P.js} +3 -3
- package/dist/{chunk-DEZZUYE2.js → chunk-ABA2ZSBQ.js} +3 -3
- package/dist/{chunk-NRF6LWBC.cjs → chunk-AKKM6MOX.cjs} +15 -15
- package/dist/{chunk-ZETAZZLD.cjs → chunk-ATLFMKAF.cjs} +7 -7
- package/dist/{chunk-V45XJKHW.cjs → chunk-B4SDEBN7.cjs} +3 -3
- package/dist/{chunk-2IOOEY45.cjs → chunk-B6UIKBHR.cjs} +4 -4
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/{chunk-E74U6CYP.cjs → chunk-BYUT376O.cjs} +3 -3
- package/dist/{chunk-OYTYSY7G.js → chunk-D53CE4BT.js} +7 -7
- package/dist/{chunk-IRFL4MAX.js → chunk-DPLL67OT.js} +2 -2
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/{chunk-5KJFVIQT.cjs → chunk-EK7FSI7F.cjs} +3 -3
- package/dist/{chunk-PZQ6I4JJ.cjs → chunk-F3WBQKRI.cjs} +1 -8
- package/dist/{chunk-SBKGWRS5.js → chunk-FI76UZRF.js} +2 -2
- package/dist/{chunk-IZPBKKPO.js → chunk-GAJBF6DR.js} +2 -2
- package/dist/{chunk-DWF2R5GD.cjs → chunk-H5NWBTHW.cjs} +61 -61
- package/dist/{chunk-W2WNBUDE.js → chunk-JY4HLZ4W.js} +2 -2
- package/dist/{chunk-5757UBXJ.cjs → chunk-K3SONK25.cjs} +24 -24
- package/dist/{chunk-HYRQMTRH.cjs → chunk-K63WO3XA.cjs} +4 -4
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-RIPKY4RU.js → chunk-KPCDDYTZ.js} +2 -2
- package/dist/{chunk-F6IPNNSJ.cjs → chunk-KTQLDIIT.cjs} +161 -161
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-GGEADHZO.js → chunk-LBNOZIZ6.js} +5 -5
- package/dist/{chunk-3VA554KW.js → chunk-LEX4TQW2.js} +2 -2
- package/dist/{chunk-KVAL5PAG.cjs → chunk-LIU4S3JA.cjs} +4 -4
- package/dist/{chunk-2WA36TC5.cjs → chunk-ME7Q2M5I.cjs} +22 -22
- package/dist/{chunk-E55EQK2U.cjs → chunk-NREACG6M.cjs} +3 -3
- package/dist/{chunk-T2T7K3KR.js → chunk-OFBFGFVH.js} +2 -2
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-XABCB3Y7.cjs → chunk-OS5OT5JA.cjs} +126 -126
- package/dist/{chunk-GQR4R5WY.js → chunk-PZQC3FZY.js} +4 -4
- package/dist/{chunk-FWHNWL2P.cjs → chunk-QAPYHLHC.cjs} +3 -3
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/{chunk-YKPSRP5G.js → chunk-QUITZ3GP.js} +8 -8
- package/dist/{chunk-7ODAAXX5.cjs → chunk-RIEYB2AW.cjs} +71 -71
- package/dist/{chunk-LS6U7FAY.cjs → chunk-RMJC3B5P.cjs} +26 -26
- package/dist/{chunk-JMJQCN74.js → chunk-SN6YRDLG.js} +9 -9
- package/dist/{chunk-NBZWMBO6.js → chunk-SZJ7OI4S.js} +3 -3
- package/dist/{chunk-FWCKOJZM.js → chunk-TDPYR5JY.js} +10 -10
- package/dist/{chunk-OI5XKNZO.js → chunk-TDYGYHSH.js} +4 -4
- package/dist/{chunk-CAH33WOQ.cjs → chunk-TFDXRT6D.cjs} +3 -3
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/{chunk-HQWOFR56.cjs → chunk-UKAUXY2U.cjs} +12 -12
- package/dist/{chunk-H66AC7GK.cjs → chunk-URDI3IMY.cjs} +19 -19
- package/dist/{chunk-6JFCSH7J.js → chunk-VCVND6CH.js} +2 -2
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-QBKAEVYG.js → chunk-VNADVWSJ.js} +3 -3
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/{chunk-2CQX5CBG.js → chunk-XFTUHS4Y.js} +4 -4
- package/dist/{chunk-T7PU2V7X.cjs → chunk-YC7AK3KX.cjs} +31 -31
- package/dist/{chunk-EL6A35UR.cjs → chunk-YGB2BQPB.cjs} +8 -8
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/{chunk-5IGC6PBH.js → chunk-ZN53RM3R.js} +2 -2
- package/dist/conversions/index.cjs +34 -34
- package/dist/conversions/index.d.ts +1 -1
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +1 -1
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +8 -8
- package/dist/generators/index.d.ts +1 -1
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -14
- package/dist/isPlainObject-FWmcJF6k.d.ts +1 -1
- package/dist/next/index.cjs +35 -35
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +7 -7
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +1 -1
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +1 -1
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +4 -4
- package/dist/parsers/index.d.ts +1 -1
- package/dist/parsers/index.js +3 -3
- package/dist/predicates/index.cjs +74 -82
- package/dist/predicates/index.d.ts +2 -23
- package/dist/predicates/index.js +12 -12
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +1 -1
- package/dist/promises/index.js +4 -4
- package/dist/rzl-utils.global.js +2 -17
- package/dist/strings/index.cjs +23 -23
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +7 -7
- package/dist/tailwind/index.cjs +11 -11
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tailwind/index.js +4 -4
- package/dist/urls/index.cjs +19 -19
- package/dist/urls/index.d.ts +1 -1
- package/dist/urls/index.js +13 -13
- package/package.json +1 -1
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.5.
|
|
5
|
+
* Version: 3.5.4.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
var chunkB6UIKBHR_cjs = require('./chunk-B6UIKBHR.cjs');
|
|
13
|
+
var chunkEK7FSI7F_cjs = require('./chunk-EK7FSI7F.cjs');
|
|
14
|
+
var chunkB4SDEBN7_cjs = require('./chunk-B4SDEBN7.cjs');
|
|
15
15
|
var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
16
|
+
var chunkNREACG6M_cjs = require('./chunk-NREACG6M.cjs');
|
|
17
|
+
var chunkK63WO3XA_cjs = require('./chunk-K63WO3XA.cjs');
|
|
18
|
+
var chunkYC7AK3KX_cjs = require('./chunk-YC7AK3KX.cjs');
|
|
19
|
+
var chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
|
|
20
20
|
var max = require('libphonenumber-js/max');
|
|
21
21
|
var locale = require('date-fns/locale');
|
|
22
22
|
var dateFns = require('date-fns');
|
|
@@ -28,69 +28,69 @@ var formatIndianNumber = (numStr, separator) => {
|
|
|
28
28
|
return rest.replace(/\B(?=(\d{2})+(?!\d))/g, separator) + separator + lastThree;
|
|
29
29
|
};
|
|
30
30
|
var formatCurrency = (value, options = {}) => {
|
|
31
|
-
if (!
|
|
31
|
+
if (!chunkF3WBQKRI_cjs.isString(value) && !chunkB4SDEBN7_cjs.isFinite(value)) {
|
|
32
32
|
throw new TypeError(
|
|
33
|
-
`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${
|
|
33
|
+
`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
34
34
|
value
|
|
35
|
-
)}\`, with value: \`${
|
|
35
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(value)}\`.`
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
39
39
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
40
40
|
});
|
|
41
|
-
const decimal =
|
|
42
|
-
const totalDecimal =
|
|
43
|
-
const endDecimal =
|
|
44
|
-
const indianFormat =
|
|
45
|
-
const suffixCurrency =
|
|
46
|
-
const suffixDecimal =
|
|
47
|
-
const roundedDecimal =
|
|
48
|
-
const negativeFormat =
|
|
49
|
-
let separatorDecimals =
|
|
50
|
-
let separator =
|
|
51
|
-
if (!
|
|
41
|
+
const decimal = chunkF3WBQKRI_cjs.hasOwnProp(options, "decimal") ? options.decimal : false;
|
|
42
|
+
const totalDecimal = chunkF3WBQKRI_cjs.hasOwnProp(options, "totalDecimal") ? options.totalDecimal : 2;
|
|
43
|
+
const endDecimal = chunkF3WBQKRI_cjs.hasOwnProp(options, "endDecimal") ? options.endDecimal : true;
|
|
44
|
+
const indianFormat = chunkF3WBQKRI_cjs.hasOwnProp(options, "indianFormat") ? options.indianFormat : false;
|
|
45
|
+
const suffixCurrency = chunkF3WBQKRI_cjs.hasOwnProp(options, "suffixCurrency") ? options.suffixCurrency : "";
|
|
46
|
+
const suffixDecimal = chunkF3WBQKRI_cjs.hasOwnProp(options, "suffixDecimal") ? options.suffixDecimal : "";
|
|
47
|
+
const roundedDecimal = chunkF3WBQKRI_cjs.hasOwnProp(options, "roundedDecimal") ? options.roundedDecimal : "round";
|
|
48
|
+
const negativeFormat = chunkF3WBQKRI_cjs.hasOwnProp(options, "negativeFormat") ? options.negativeFormat : "dash";
|
|
49
|
+
let separatorDecimals = chunkF3WBQKRI_cjs.hasOwnProp(options, "separatorDecimals") ? options.separatorDecimals : ",";
|
|
50
|
+
let separator = chunkF3WBQKRI_cjs.hasOwnProp(options, "separator") ? options.separator : ".";
|
|
51
|
+
if (!chunkF3WBQKRI_cjs.isString(separator) || !chunkF3WBQKRI_cjs.isString(separatorDecimals) || !chunkF3WBQKRI_cjs.isString(suffixCurrency) || !chunkF3WBQKRI_cjs.isString(suffixDecimal)) {
|
|
52
52
|
throw new TypeError(
|
|
53
|
-
`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${
|
|
53
|
+
`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
54
54
|
separator
|
|
55
|
-
)}\`, 'separatorDecimals': \`${
|
|
55
|
+
)}\`, 'separatorDecimals': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
56
56
|
separatorDecimals
|
|
57
|
-
)}\`, 'suffixCurrency': \`${
|
|
57
|
+
)}\`, 'suffixCurrency': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
58
58
|
suffixCurrency
|
|
59
|
-
)}\`, 'suffixDecimal': \`${
|
|
59
|
+
)}\`, 'suffixDecimal': \`${chunkF3WBQKRI_cjs.getPreciseType(suffixDecimal)}\`].`
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
if (!
|
|
62
|
+
if (!chunkF3WBQKRI_cjs.isBoolean(decimal) || !chunkF3WBQKRI_cjs.isBoolean(endDecimal) || !chunkF3WBQKRI_cjs.isBoolean(indianFormat)) {
|
|
63
63
|
throw new TypeError(
|
|
64
|
-
`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${
|
|
64
|
+
`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
65
65
|
decimal
|
|
66
|
-
)}\`, 'endDecimal': \`${
|
|
66
|
+
)}\`, 'endDecimal': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
67
67
|
endDecimal
|
|
68
|
-
)}\`, 'indianFormat': \`${
|
|
68
|
+
)}\`, 'indianFormat': \`${chunkF3WBQKRI_cjs.getPreciseType(indianFormat)}\`].`
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
if (!chunkDVMHRLKP_cjs.isInteger(totalDecimal)) {
|
|
72
72
|
throw new TypeError(
|
|
73
|
-
`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${
|
|
73
|
+
`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
74
74
|
totalDecimal
|
|
75
|
-
)}\`, with value: \`${
|
|
75
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(length)}\`.`
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
if (!(roundedDecimal === false || roundedDecimal === "round" || roundedDecimal === "ceil" || roundedDecimal === "floor")) {
|
|
79
79
|
throw new TypeError(
|
|
80
|
-
`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${
|
|
80
|
+
`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
81
81
|
roundedDecimal
|
|
82
|
-
)}\`, with value: \`${
|
|
82
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(roundedDecimal)}\`.`
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
if (!(negativeFormat === "abs" || negativeFormat === "brackets" || negativeFormat === "dash" ||
|
|
85
|
+
if (!(negativeFormat === "abs" || negativeFormat === "brackets" || negativeFormat === "dash" || chunkF3WBQKRI_cjs.isPlainObject(negativeFormat))) {
|
|
86
86
|
throw new TypeError(
|
|
87
|
-
`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${
|
|
87
|
+
`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
88
88
|
negativeFormat
|
|
89
|
-
)}\`, with value: \`${
|
|
89
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(negativeFormat)}\`.`
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
|
-
const rawNum =
|
|
93
|
-
if (
|
|
92
|
+
const rawNum = chunkF3WBQKRI_cjs.isString(value) ? chunkEK7FSI7F_cjs.parseCurrencyString(value) : value;
|
|
93
|
+
if (chunkF3WBQKRI_cjs.isNaN(rawNum)) {
|
|
94
94
|
throw new TypeError(
|
|
95
95
|
`First parameter (\`value\`) could not be parsed into a valid \`number\`.`
|
|
96
96
|
);
|
|
@@ -129,7 +129,7 @@ var formatCurrency = (value, options = {}) => {
|
|
|
129
129
|
} else {
|
|
130
130
|
formattedInteger = (suffixCurrency.trim().length ? suffixCurrency : "") + integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
131
131
|
}
|
|
132
|
-
if (decimal && !
|
|
132
|
+
if (decimal && !chunkF3WBQKRI_cjs.isUndefined(decimalPartRaw) && totalDecimal > 0) {
|
|
133
133
|
let formattedDecimal = separatorDecimals + decimalPartRaw;
|
|
134
134
|
if (endDecimal) formattedDecimal += suffixDecimal;
|
|
135
135
|
formattedInteger += formattedDecimal;
|
|
@@ -139,32 +139,32 @@ var formatCurrency = (value, options = {}) => {
|
|
|
139
139
|
formattedInteger = "-" + formattedInteger;
|
|
140
140
|
} else if (negativeFormat === "brackets") {
|
|
141
141
|
formattedInteger = "(" + formattedInteger + ")";
|
|
142
|
-
} else if (negativeFormat === "abs") ; else if (
|
|
143
|
-
if (
|
|
142
|
+
} else if (negativeFormat === "abs") ; else if (chunkF3WBQKRI_cjs.isPlainObject(negativeFormat)) {
|
|
143
|
+
if (chunkF3WBQKRI_cjs.hasOwnProp(negativeFormat, "custom")) {
|
|
144
144
|
const formatCustomNegative = negativeFormat.custom;
|
|
145
|
-
if (!
|
|
145
|
+
if (!chunkF3WBQKRI_cjs.isFunction(formatCustomNegative)) {
|
|
146
146
|
throw new TypeError(
|
|
147
|
-
`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${
|
|
147
|
+
`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
148
148
|
formatCustomNegative
|
|
149
149
|
)}\`.`
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
const result = formatCustomNegative(formattedInteger);
|
|
153
|
-
|
|
153
|
+
chunkK63WO3XA_cjs.assertIsString(result, {
|
|
154
154
|
message: ({ currentType, validType }) => `Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${validType}\` type value, but received: \`${currentType}\`.`
|
|
155
155
|
});
|
|
156
156
|
formattedInteger = result;
|
|
157
157
|
} else {
|
|
158
158
|
const formatStyleNegative = negativeFormat.style || "dash";
|
|
159
|
-
const formatSpaceNegative = !
|
|
160
|
-
|
|
159
|
+
const formatSpaceNegative = !chunkF3WBQKRI_cjs.isUndefined(negativeFormat.space) ? negativeFormat.space : false;
|
|
160
|
+
chunkF3WBQKRI_cjs.assertIsBoolean(formatSpaceNegative, {
|
|
161
161
|
message: ({ currentType, validType }) => `Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${validType} or undefined\`, but received: \`${currentType}\`.`
|
|
162
162
|
});
|
|
163
163
|
if (!(formatStyleNegative === "abs" || formatStyleNegative === "brackets" || formatStyleNegative === "dash")) {
|
|
164
164
|
throw new TypeError(
|
|
165
|
-
`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${
|
|
165
|
+
`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
166
166
|
formatStyleNegative
|
|
167
|
-
)}\`, with value: \`${
|
|
167
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(formatStyleNegative)}\`.`
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
switch (formatStyleNegative) {
|
|
@@ -182,21 +182,21 @@ var formatCurrency = (value, options = {}) => {
|
|
|
182
182
|
};
|
|
183
183
|
|
|
184
184
|
var formatNumber = (value, separator = ",") => {
|
|
185
|
-
if (!
|
|
185
|
+
if (!chunkF3WBQKRI_cjs.isString(value) && !chunkB4SDEBN7_cjs.isFinite(value)) {
|
|
186
186
|
throw new TypeError(
|
|
187
|
-
`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${
|
|
187
|
+
`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
188
188
|
value
|
|
189
189
|
)}\`.`
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
|
-
if (!
|
|
192
|
+
if (!chunkF3WBQKRI_cjs.isString(separator)) {
|
|
193
193
|
throw new TypeError(
|
|
194
|
-
`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${
|
|
194
|
+
`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
195
195
|
separator
|
|
196
196
|
)}\`.`
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
|
-
separator =
|
|
199
|
+
separator = chunkF3WBQKRI_cjs.isString(separator) ? separator : ",";
|
|
200
200
|
const decimalSeparator = separator === "." ? "," : separator === "," ? "." : ".";
|
|
201
201
|
const stringValue = value.toString().trim();
|
|
202
202
|
const lastDot = stringValue.lastIndexOf(".");
|
|
@@ -235,42 +235,42 @@ var isValidParseAsYouType = (parsedAsYouType) => {
|
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
function formatPhoneNumber(value, options = {}) {
|
|
238
|
-
if (
|
|
239
|
-
if (!
|
|
238
|
+
if (chunkF3WBQKRI_cjs.isNil(value)) return "";
|
|
239
|
+
if (!chunkF3WBQKRI_cjs.isString(value) && !chunkF3WBQKRI_cjs.isNumber(value)) {
|
|
240
240
|
throw new TypeError(
|
|
241
|
-
`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${
|
|
241
|
+
`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
242
242
|
value
|
|
243
243
|
)}\`.`
|
|
244
244
|
);
|
|
245
245
|
}
|
|
246
|
-
|
|
246
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
247
247
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
248
248
|
});
|
|
249
|
-
const takeNumberOnly =
|
|
250
|
-
const checkValidOnly =
|
|
251
|
-
const defaultCountry =
|
|
249
|
+
const takeNumberOnly = chunkF3WBQKRI_cjs.hasOwnProp(options, "takeNumberOnly") ? options.takeNumberOnly : false;
|
|
250
|
+
const checkValidOnly = chunkF3WBQKRI_cjs.hasOwnProp(options, "checkValidOnly") ? options.checkValidOnly : false;
|
|
251
|
+
const defaultCountry = chunkF3WBQKRI_cjs.hasOwnProp(
|
|
252
252
|
options,
|
|
253
253
|
"defaultCountry"
|
|
254
254
|
) ? options.defaultCountry : void 0;
|
|
255
|
-
const separator =
|
|
256
|
-
const prependPlusCountryCode =
|
|
257
|
-
const outputFormat =
|
|
258
|
-
const openingNumberCountry =
|
|
259
|
-
const closingNumberCountry =
|
|
260
|
-
if (!
|
|
255
|
+
const separator = chunkF3WBQKRI_cjs.hasOwnProp(options, "separator") ? options.separator : " ";
|
|
256
|
+
const prependPlusCountryCode = chunkF3WBQKRI_cjs.hasOwnProp(options, "prependPlusCountryCode") ? options.prependPlusCountryCode : true;
|
|
257
|
+
const outputFormat = chunkF3WBQKRI_cjs.hasOwnProp(options, "outputFormat") ? options.outputFormat : "INTERNATIONAL";
|
|
258
|
+
const openingNumberCountry = chunkF3WBQKRI_cjs.hasOwnProp(options, "openingNumberCountry") ? options.openingNumberCountry : "";
|
|
259
|
+
const closingNumberCountry = chunkF3WBQKRI_cjs.hasOwnProp(options, "closingNumberCountry") ? options.closingNumberCountry : "";
|
|
260
|
+
if (!chunkF3WBQKRI_cjs.isBoolean(takeNumberOnly) || !chunkF3WBQKRI_cjs.isBoolean(checkValidOnly) || !chunkF3WBQKRI_cjs.isBoolean(prependPlusCountryCode)) {
|
|
261
261
|
throw new TypeError(
|
|
262
|
-
`Parameter \`takeNumberOnly\`, \`checkValidOnly\` and \`prependPlusCountryCode\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${
|
|
262
|
+
`Parameter \`takeNumberOnly\`, \`checkValidOnly\` and \`prependPlusCountryCode\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
263
263
|
takeNumberOnly
|
|
264
|
-
)}\`, 'checkValidOnly': \`${
|
|
264
|
+
)}\`, 'checkValidOnly': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
265
265
|
checkValidOnly
|
|
266
|
-
)}\`, 'prependPlusCountryCode': \`${
|
|
266
|
+
)}\`, 'prependPlusCountryCode': \`${chunkF3WBQKRI_cjs.getPreciseType(prependPlusCountryCode)}\`].`
|
|
267
267
|
);
|
|
268
268
|
}
|
|
269
|
-
if (!
|
|
269
|
+
if (!chunkF3WBQKRI_cjs.isUndefined(defaultCountry) && !max.isSupportedCountry(defaultCountry)) {
|
|
270
270
|
throw new TypeError(
|
|
271
|
-
`Parameter \`defaultCountry\` property of the \`options\` (second parameter) must be of type \`string\` as \`CountryCode\` (ISO-3166-1 alpha-2) or unset as \`undefined\` value, but received: \`${
|
|
271
|
+
`Parameter \`defaultCountry\` property of the \`options\` (second parameter) must be of type \`string\` as \`CountryCode\` (ISO-3166-1 alpha-2) or unset as \`undefined\` value, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
272
272
|
defaultCountry
|
|
273
|
-
)}\`, with value: \`${
|
|
273
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(defaultCountry, {
|
|
274
274
|
keepUndefined: true
|
|
275
275
|
})}\`.
|
|
276
276
|
|
|
@@ -279,21 +279,21 @@ See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_e
|
|
|
279
279
|
}
|
|
280
280
|
if (!["INTERNATIONAL", "NATIONAL", "RFC3966", "E.164"].includes(outputFormat)) {
|
|
281
281
|
throw new TypeError(
|
|
282
|
-
`Parameter \`outputFormat\` property of the \`options\` (second parameter) must be of type \`string\` as \`OutputFormat\` ("NATIONAL" | "INTERNATIONAL" | "E.164" | "RFC3966") or unset as \`undefined\` (default value to: \`INTERNATIONAL\`) value, but received: \`${
|
|
282
|
+
`Parameter \`outputFormat\` property of the \`options\` (second parameter) must be of type \`string\` as \`OutputFormat\` ("NATIONAL" | "INTERNATIONAL" | "E.164" | "RFC3966") or unset as \`undefined\` (default value to: \`INTERNATIONAL\`) value, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
283
283
|
outputFormat
|
|
284
|
-
)}\`, with value: ${
|
|
284
|
+
)}\`, with value: ${chunkYC7AK3KX_cjs.safeStableStringify(outputFormat, { keepUndefined: true })}.`
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
|
-
if (!
|
|
287
|
+
if (!chunkF3WBQKRI_cjs.isString(separator) || !chunkF3WBQKRI_cjs.isString(openingNumberCountry) || !chunkF3WBQKRI_cjs.isString(closingNumberCountry)) {
|
|
288
288
|
throw new TypeError(
|
|
289
|
-
`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${
|
|
289
|
+
`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
290
290
|
separator
|
|
291
|
-
)}\`,'openingNumberCountry': \`${
|
|
291
|
+
)}\`,'openingNumberCountry': \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
292
292
|
openingNumberCountry
|
|
293
|
-
)}\`, 'closingNumberCountry': \`${
|
|
293
|
+
)}\`, 'closingNumberCountry': \`${chunkF3WBQKRI_cjs.getPreciseType(closingNumberCountry)}\`].`
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
if (!
|
|
296
|
+
if (!chunkF3WBQKRI_cjs.isString(value)) value = String(value);
|
|
297
297
|
const parsedPhoneNumber = parsingAsYouType(value, defaultCountry);
|
|
298
298
|
const validPhoneNumber = isValidParseAsYouType(parsedPhoneNumber);
|
|
299
299
|
if (checkValidOnly) return validPhoneNumber;
|
|
@@ -307,7 +307,7 @@ See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_e
|
|
|
307
307
|
const [cc, ...rest] = intlNumb.split(" ");
|
|
308
308
|
const countryCode = prependPlusCountryCode ? cc : cc.replace(/^\++/, "");
|
|
309
309
|
const restWithSeparator = rest.join(separator);
|
|
310
|
-
if (
|
|
310
|
+
if (chunkF3WBQKRI_cjs.isNonEmptyString(openingNumberCountry) && chunkF3WBQKRI_cjs.isNonEmptyString(closingNumberCountry)) {
|
|
311
311
|
return `${openingNumberCountry}${countryCode}${closingNumberCountry} ${restWithSeparator}`;
|
|
312
312
|
}
|
|
313
313
|
return `${countryCode} ${restWithSeparator}`;
|
|
@@ -337,7 +337,7 @@ var _censor = (str, minCensor, maxPercentage, hashSeed) => {
|
|
|
337
337
|
const indexes = /* @__PURE__ */ new Set();
|
|
338
338
|
let i = 0;
|
|
339
339
|
while (indexes.size < totalCensor) {
|
|
340
|
-
const idx = !
|
|
340
|
+
const idx = !chunkF3WBQKRI_cjs.isUndefined(hashSeed) ? (hashSeed + str.length + i * 31) % str.length : Math.floor(Math.random() * str.length);
|
|
341
341
|
indexes.add(idx);
|
|
342
342
|
i++;
|
|
343
343
|
}
|
|
@@ -348,16 +348,16 @@ var _censor = (str, minCensor, maxPercentage, hashSeed) => {
|
|
|
348
348
|
};
|
|
349
349
|
|
|
350
350
|
var censorEmail = (email, options = {}) => {
|
|
351
|
-
if (!
|
|
352
|
-
|
|
351
|
+
if (!chunkF3WBQKRI_cjs.isNonEmptyString(email)) return "";
|
|
352
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
353
353
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
354
354
|
});
|
|
355
|
-
const mode =
|
|
355
|
+
const mode = chunkF3WBQKRI_cjs.hasOwnProp(options, "mode") ? options.mode : "fixed";
|
|
356
356
|
if (mode !== "random" && mode !== "fixed") {
|
|
357
357
|
throw new TypeError(
|
|
358
|
-
`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${
|
|
358
|
+
`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
359
359
|
mode
|
|
360
|
-
)}\`, with value: \`${
|
|
360
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(mode)}\`.`
|
|
361
361
|
);
|
|
362
362
|
}
|
|
363
363
|
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
@@ -377,29 +377,29 @@ var censorEmail = (email, options = {}) => {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
function chunkString(subject, limiter, options = {}) {
|
|
380
|
-
if (
|
|
381
|
-
|
|
380
|
+
if (chunkF3WBQKRI_cjs.isNil(subject) || limiter <= 0) return subject;
|
|
381
|
+
chunkK63WO3XA_cjs.assertIsString(subject, {
|
|
382
382
|
message: ({ currentType, validType }) => `First parameter (\`subject\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
383
383
|
});
|
|
384
384
|
if (!chunkDVMHRLKP_cjs.isInteger(limiter)) {
|
|
385
385
|
throw new TypeError(
|
|
386
|
-
`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${
|
|
386
|
+
`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
387
387
|
limiter
|
|
388
|
-
)}\`, with value: \`${
|
|
388
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(limiter)}\`.`
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
392
392
|
message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
393
393
|
});
|
|
394
|
-
const separator =
|
|
395
|
-
const reCountAfterSpace =
|
|
396
|
-
|
|
394
|
+
const separator = chunkF3WBQKRI_cjs.hasOwnProp(options, "separator") ? options.separator : " ";
|
|
395
|
+
const reCountAfterSpace = chunkF3WBQKRI_cjs.hasOwnProp(options, "reCountAfterSpace") ? options.reCountAfterSpace : false;
|
|
396
|
+
chunkK63WO3XA_cjs.assertIsString(separator, {
|
|
397
397
|
message: ({ currentType, validType }) => `Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
398
398
|
});
|
|
399
|
-
|
|
399
|
+
chunkF3WBQKRI_cjs.assertIsBoolean(reCountAfterSpace, {
|
|
400
400
|
message: ({ currentType, validType }) => `Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
401
401
|
});
|
|
402
|
-
subject =
|
|
402
|
+
subject = chunkB6UIKBHR_cjs.normalizeSpaces(subject);
|
|
403
403
|
if (!reCountAfterSpace) {
|
|
404
404
|
let result = "";
|
|
405
405
|
let currentCount = 0;
|
|
@@ -442,28 +442,28 @@ function chunkString(subject, limiter, options = {}) {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
var truncateString = (text, options = {}) => {
|
|
445
|
-
if (!
|
|
446
|
-
|
|
445
|
+
if (!chunkF3WBQKRI_cjs.isNonEmptyString(text)) return "";
|
|
446
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
447
447
|
message: ({ currentType, validType }) => `Seconds parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
448
448
|
});
|
|
449
|
-
const trim =
|
|
450
|
-
const length2 =
|
|
451
|
-
let ending =
|
|
449
|
+
const trim = chunkF3WBQKRI_cjs.hasOwnProp(options, "trim") ? options.trim : true;
|
|
450
|
+
const length2 = chunkF3WBQKRI_cjs.hasOwnProp(options, "length") ? options.length : 10;
|
|
451
|
+
let ending = chunkF3WBQKRI_cjs.hasOwnProp(options, "ending") ? options.ending : "...";
|
|
452
452
|
if (!chunkDVMHRLKP_cjs.isInteger(length2)) {
|
|
453
453
|
throw new TypeError(
|
|
454
|
-
`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${
|
|
454
|
+
`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
455
455
|
length2
|
|
456
|
-
)}\`, with value: \`${
|
|
456
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(length2)}\`.`
|
|
457
457
|
);
|
|
458
458
|
}
|
|
459
459
|
if (length2 < 1) return "";
|
|
460
|
-
|
|
460
|
+
chunkK63WO3XA_cjs.assertIsString(ending, {
|
|
461
461
|
message: ({ currentType, validType }) => `Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
462
462
|
});
|
|
463
|
-
|
|
463
|
+
chunkF3WBQKRI_cjs.assertIsBoolean(trim, {
|
|
464
464
|
message: ({ currentType, validType }) => `Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
465
465
|
});
|
|
466
|
-
if (
|
|
466
|
+
if (chunkNREACG6M_cjs.isEmptyString(ending)) {
|
|
467
467
|
ending = "...";
|
|
468
468
|
} else {
|
|
469
469
|
ending = ending.trim();
|
|
@@ -476,24 +476,24 @@ var truncateString = (text, options = {}) => {
|
|
|
476
476
|
return cleanSliced + ending;
|
|
477
477
|
};
|
|
478
478
|
var formatDateFns = (date, options = {}) => {
|
|
479
|
-
if (
|
|
480
|
-
if (!
|
|
479
|
+
if (chunkF3WBQKRI_cjs.isNil(date) || !(chunkYC7AK3KX_cjs.isDate(date) || chunkF3WBQKRI_cjs.isNonEmptyString(date))) return null;
|
|
480
|
+
if (!chunkF3WBQKRI_cjs.isPlainObject(options)) {
|
|
481
481
|
options = {};
|
|
482
482
|
}
|
|
483
483
|
const { inputFormat, locale: locale$1 = "en", inputLocale = "en", ...restOptions } = options;
|
|
484
|
-
const format =
|
|
484
|
+
const format = chunkF3WBQKRI_cjs.hasOwnProp(options, "format") && chunkF3WBQKRI_cjs.isNonEmptyString(options.format) ? options.format : "dd MMM yyyy - HH:mm:ss";
|
|
485
485
|
let parsedDate;
|
|
486
486
|
try {
|
|
487
|
-
if (
|
|
488
|
-
const valueOfInputLocale =
|
|
487
|
+
if (chunkF3WBQKRI_cjs.isNonEmptyString(date) && inputFormat && inputLocale) {
|
|
488
|
+
const valueOfInputLocale = chunkF3WBQKRI_cjs.isNonEmptyString(inputLocale) ? inputLocale === "id" ? locale.id : locale.enUS : inputLocale;
|
|
489
489
|
parsedDate = dateFns.parse(date, inputFormat, /* @__PURE__ */ new Date(), {
|
|
490
490
|
locale: valueOfInputLocale
|
|
491
491
|
});
|
|
492
492
|
} else {
|
|
493
493
|
parsedDate = new Date(date);
|
|
494
494
|
}
|
|
495
|
-
if (
|
|
496
|
-
const valueOfLocale =
|
|
495
|
+
if (chunkF3WBQKRI_cjs.isNaN(parsedDate.getTime())) return null;
|
|
496
|
+
const valueOfLocale = chunkF3WBQKRI_cjs.isNonEmptyString(locale$1) ? locale$1 === "id" ? locale.id : locale.enUS : locale$1;
|
|
497
497
|
return dateFns.format(parsedDate, format, {
|
|
498
498
|
...restOptions,
|
|
499
499
|
locale: valueOfLocale
|
|
@@ -504,16 +504,16 @@ var formatDateFns = (date, options = {}) => {
|
|
|
504
504
|
};
|
|
505
505
|
|
|
506
506
|
var formatDateIntl = (date, options) => {
|
|
507
|
-
if (
|
|
507
|
+
if (chunkF3WBQKRI_cjs.isNil(date) || !(chunkYC7AK3KX_cjs.isDate(date) || chunkF3WBQKRI_cjs.isNonEmptyString(date))) return null;
|
|
508
508
|
const parsedDate = new Date(date);
|
|
509
|
-
if (
|
|
510
|
-
if (!
|
|
509
|
+
if (chunkF3WBQKRI_cjs.isNaN(parsedDate.getTime())) return null;
|
|
510
|
+
if (!chunkF3WBQKRI_cjs.isPlainObject(options)) {
|
|
511
511
|
options = {};
|
|
512
512
|
}
|
|
513
513
|
const { locale = "en-US", ...restProps } = options;
|
|
514
514
|
try {
|
|
515
515
|
return new Intl.DateTimeFormat(
|
|
516
|
-
|
|
516
|
+
chunkF3WBQKRI_cjs.isNonEmptyString(locale) ? locale.trim() : "en-US",
|
|
517
517
|
restProps
|
|
518
518
|
).format(parsedDate);
|
|
519
519
|
} catch {
|
|
@@ -522,16 +522,16 @@ var formatDateIntl = (date, options) => {
|
|
|
522
522
|
};
|
|
523
523
|
|
|
524
524
|
var formatDateTime = (date, format) => {
|
|
525
|
-
if (
|
|
525
|
+
if (chunkF3WBQKRI_cjs.isNil(format)) {
|
|
526
526
|
format = "YYYY-MM-DD hh:mm:ss";
|
|
527
527
|
}
|
|
528
|
-
if (!
|
|
529
|
-
if (
|
|
528
|
+
if (!chunkF3WBQKRI_cjs.isString(format)) return null;
|
|
529
|
+
if (chunkF3WBQKRI_cjs.isNil(date) || !(chunkYC7AK3KX_cjs.isDate(date) || chunkF3WBQKRI_cjs.isNonEmptyString(date))) {
|
|
530
530
|
return null;
|
|
531
531
|
}
|
|
532
532
|
try {
|
|
533
533
|
const parsedDate = new Date(date);
|
|
534
|
-
if (
|
|
534
|
+
if (chunkF3WBQKRI_cjs.isNaN(parsedDate.getTime())) return null;
|
|
535
535
|
const pad2 = (n) => n.toString().padStart(2, "0");
|
|
536
536
|
const map = {
|
|
537
537
|
YYYY: parsedDate.getFullYear().toString(),
|
|
@@ -553,13 +553,13 @@ var formatDateTime = (date, format) => {
|
|
|
553
553
|
|
|
554
554
|
var getGMTOffset = (date) => {
|
|
555
555
|
try {
|
|
556
|
-
if (
|
|
556
|
+
if (chunkF3WBQKRI_cjs.isNil(date) || chunkF3WBQKRI_cjs.isString(date) && chunkNREACG6M_cjs.isEmptyString(date)) {
|
|
557
557
|
date = /* @__PURE__ */ new Date();
|
|
558
|
-
} else if (!(
|
|
558
|
+
} else if (!(chunkYC7AK3KX_cjs.isDate(date) || chunkF3WBQKRI_cjs.isNonEmptyString(date))) {
|
|
559
559
|
return "0";
|
|
560
560
|
}
|
|
561
561
|
const parsedDate = new Date(date);
|
|
562
|
-
if (
|
|
562
|
+
if (chunkF3WBQKRI_cjs.isNaN(parsedDate.getTime())) return "0";
|
|
563
563
|
const padZero = (num) => num.toString().padStart(2, "0");
|
|
564
564
|
let offset = parsedDate.getTimezoneOffset();
|
|
565
565
|
const sign = offset < 0 ? "+" : "-";
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.5.
|
|
5
|
+
* Version: 3.5.4.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isEmptyString } from './chunk-
|
|
11
|
-
import { isEmptyArray, isEmptyObject } from './chunk-
|
|
12
|
-
import { assertIsPlainObject, hasOwnProp, assertIsBoolean, isNil, isNaN, isString, isArray, isObject } from './chunk-
|
|
10
|
+
import { isEmptyString } from './chunk-JY4HLZ4W.js';
|
|
11
|
+
import { isEmptyArray, isEmptyObject } from './chunk-VCVND6CH.js';
|
|
12
|
+
import { assertIsPlainObject, hasOwnProp, assertIsBoolean, isNil, isNaN, isString, isArray, isObject } from './chunk-3KTD3QDI.js';
|
|
13
13
|
|
|
14
14
|
var isEmptyValue = (value, options = {}) => {
|
|
15
15
|
assertIsPlainObject(options, {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.5.
|
|
5
|
+
* Version: 3.5.4.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
|
|
13
13
|
|
|
14
14
|
var KNOWN_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
15
15
|
// 📄 Text & Document
|
|
@@ -393,7 +393,7 @@ var DOUBLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
393
393
|
"tar.xz"
|
|
394
394
|
]);
|
|
395
395
|
var extractFileName = (url) => {
|
|
396
|
-
if (!
|
|
396
|
+
if (!chunkF3WBQKRI_cjs.isNonEmptyString(url)) return void 0;
|
|
397
397
|
let fileName = url.split("/").pop();
|
|
398
398
|
if (fileName === "") return "";
|
|
399
399
|
if (!fileName) return void 0;
|
package/dist/chunk-QNKGP5DY.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.5.
|
|
5
|
+
* Version: 3.5.4.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.5.
|
|
5
|
+
* Version: 3.5.4.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { normalizeSpaces } from './chunk-
|
|
11
|
-
import { parseCurrencyString } from './chunk-
|
|
12
|
-
import { isFinite } from './chunk-
|
|
10
|
+
import { normalizeSpaces } from './chunk-OFBFGFVH.js';
|
|
11
|
+
import { parseCurrencyString } from './chunk-DPLL67OT.js';
|
|
12
|
+
import { isFinite } from './chunk-7ZNEUWYP.js';
|
|
13
13
|
import { isInteger } from './chunk-WVSPXFTY.js';
|
|
14
|
-
import { isEmptyString } from './chunk-
|
|
15
|
-
import { assertIsString } from './chunk-
|
|
16
|
-
import { safeStableStringify, isDate } from './chunk-
|
|
17
|
-
import { isString, getPreciseType, assertIsPlainObject, hasOwnProp, isBoolean, isPlainObject, isNaN, isUndefined, isFunction, assertIsBoolean, isNil, isNumber, isNonEmptyString } from './chunk-
|
|
14
|
+
import { isEmptyString } from './chunk-JY4HLZ4W.js';
|
|
15
|
+
import { assertIsString } from './chunk-FI76UZRF.js';
|
|
16
|
+
import { safeStableStringify, isDate } from './chunk-2VO2CBTU.js';
|
|
17
|
+
import { isString, getPreciseType, assertIsPlainObject, hasOwnProp, isBoolean, isPlainObject, isNaN, isUndefined, isFunction, assertIsBoolean, isNil, isNumber, isNonEmptyString } from './chunk-3KTD3QDI.js';
|
|
18
18
|
import { isSupportedCountry, AsYouType } from 'libphonenumber-js/max';
|
|
19
19
|
import { id, enUS } from 'date-fns/locale';
|
|
20
20
|
import { parse, format } from 'date-fns';
|