@rzl-zone/utils-js 3.10.0 → 3.11.1
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/README.md +131 -129
- package/dist/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +487 -215
- package/dist/assertions/index.js +5 -5
- package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
- package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
- package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
- package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
- package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
- package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
- package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
- package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
- package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
- package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
- package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
- package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
- package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
- package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
- package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
- package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
- package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
- package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
- package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
- package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
- package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
- package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
- package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
- package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
- package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
- package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
- package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
- package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
- package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
- package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
- package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
- package/dist/chunk-MSUW5VHZ.js +1590 -0
- package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
- package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
- package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
- package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
- package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
- package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
- package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
- package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
- package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
- package/dist/chunk-SYHPSOUU.cjs +1626 -0
- package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
- package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
- package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
- package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
- package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
- package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
- package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
- package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
- package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
- package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
- package/dist/conversions/index.cjs +34 -34
- package/dist/conversions/index.d.ts +489 -333
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +35 -29
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +917 -873
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +9 -9
- package/dist/generators/index.d.ts +104 -86
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
- package/dist/next/index.cjs +37 -37
- package/dist/next/index.d.ts +36 -21
- package/dist/next/index.js +9 -9
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +6 -3
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +14 -5
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +6 -6
- package/dist/parsers/index.d.ts +68 -65
- package/dist/parsers/index.js +5 -5
- package/dist/predicates/index.cjs +77 -77
- package/dist/predicates/index.d.ts +442 -258
- package/dist/predicates/index.js +14 -14
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +28 -16
- package/dist/promises/index.js +4 -4
- package/dist/rzl-utils.global.js +2 -2
- package/dist/strings/index.cjs +23 -23
- package/dist/strings/index.d.ts +82 -54
- package/dist/strings/index.js +7 -7
- package/dist/tailwind/index.cjs +13 -13
- package/dist/tailwind/index.d.ts +186 -169
- package/dist/tailwind/index.js +5 -5
- package/dist/urls/index.cjs +23 -23
- package/dist/urls/index.d.ts +252 -229
- package/dist/urls/index.js +16 -16
- package/package.json +6 -4
- package/dist/chunk-7C7TQC5J.cjs +0 -620
- package/dist/chunk-J4TT33ZX.js +0 -584
- package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
package/dist/assertions/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
export { assertIsBigInt, assertIsNumber } from '../chunk-
|
|
11
|
-
export { assertIsString } from '../chunk-
|
|
12
|
-
export { assertIsArray } from '../chunk-
|
|
10
|
+
export { assertIsBigInt, assertIsNumber } from '../chunk-6LXWT2I5.js';
|
|
11
|
+
export { assertIsString } from '../chunk-3T6VSWYX.js';
|
|
12
|
+
export { assertIsArray } from '../chunk-RZOGBYIS.js';
|
|
13
13
|
import '../chunk-QNKGP5DY.js';
|
|
14
|
-
export { assertIsBoolean, assertIsPlainObject } from '../chunk-
|
|
14
|
+
export { assertIsBoolean, assertIsPlainObject } from '../chunk-MSUW5VHZ.js';
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isFinite } from './chunk-
|
|
11
|
-
import { isEmptyArray } from './chunk-
|
|
10
|
+
import { isFinite } from './chunk-CCJ2MSN7.js';
|
|
11
|
+
import { isEmptyArray } from './chunk-GOFINGT6.js';
|
|
12
12
|
import { isBigInt } from './chunk-QNKGP5DY.js';
|
|
13
|
-
import { isNil, isArray, assertIsPlainObject, hasOwnProp, assertIsBoolean, isString, isBoolean, isNull } from './chunk-
|
|
13
|
+
import { isNil, isArray, assertIsPlainObject, hasOwnProp, assertIsBoolean, isString, isBoolean, isNull } from './chunk-MSUW5VHZ.js';
|
|
14
14
|
|
|
15
15
|
function filterNilArray(input) {
|
|
16
16
|
if (isNil(input)) return void 0;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isNonEmptyString } from './chunk-
|
|
10
|
+
import { isNonEmptyString } from './chunk-MSUW5VHZ.js';
|
|
11
11
|
|
|
12
12
|
var parseCurrencyString = (input) => {
|
|
13
13
|
if (!isNonEmptyString(input)) return 0;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isString, resolveErrorMessageAssertions } from './chunk-
|
|
10
|
+
import { isString, resolveErrorMessageAssertions } from './chunk-MSUW5VHZ.js';
|
|
11
11
|
|
|
12
12
|
var assertIsString = (value, options = {}) => {
|
|
13
13
|
if (isString(value)) return;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { punycodeUtilsJS } from './chunk-
|
|
11
|
-
import { safeStableStringify } from './chunk-
|
|
12
|
-
import { isString, assertIsPlainObject, isBoolean, getPreciseType } from './chunk-
|
|
10
|
+
import { punycodeUtilsJS } from './chunk-6YGBRENU.js';
|
|
11
|
+
import { safeStableStringify } from './chunk-AXDYWO67.js';
|
|
12
|
+
import { isString, assertIsPlainObject, isBoolean, getPreciseType } from './chunk-MSUW5VHZ.js';
|
|
13
13
|
|
|
14
14
|
var sldMap_default = {
|
|
15
15
|
"com.ac": true,
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
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 chunkBMZZXZJ2_cjs = require('./chunk-BMZZXZJ2.cjs');
|
|
13
|
+
var chunkMUHRPRR7_cjs = require('./chunk-MUHRPRR7.cjs');
|
|
14
|
+
var chunkXX6RUGTM_cjs = require('./chunk-XX6RUGTM.cjs');
|
|
15
15
|
var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
16
|
+
var chunkWLOQQFDS_cjs = require('./chunk-WLOQQFDS.cjs');
|
|
17
|
+
var chunkWXFTVXBF_cjs = require('./chunk-WXFTVXBF.cjs');
|
|
18
|
+
var chunkDAPAK2W3_cjs = require('./chunk-DAPAK2W3.cjs');
|
|
19
|
+
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.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,77 +28,77 @@ 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 (!chunkSYHPSOUU_cjs.isString(value) && !chunkXX6RUGTM_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: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
34
34
|
value
|
|
35
|
-
)}\`, with value: \`${
|
|
35
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(value, {
|
|
36
36
|
keepUndefined: true
|
|
37
37
|
})}\`.`
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
41
41
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
42
42
|
});
|
|
43
|
-
const decimal =
|
|
44
|
-
const totalDecimal =
|
|
45
|
-
const endDecimal =
|
|
46
|
-
const indianFormat =
|
|
47
|
-
const suffixCurrency =
|
|
48
|
-
const suffixDecimal =
|
|
49
|
-
const roundedDecimal =
|
|
50
|
-
const negativeFormat =
|
|
51
|
-
let separatorDecimals =
|
|
52
|
-
let separator =
|
|
53
|
-
if (!
|
|
43
|
+
const decimal = chunkSYHPSOUU_cjs.hasOwnProp(options, "decimal") ? options.decimal : false;
|
|
44
|
+
const totalDecimal = chunkSYHPSOUU_cjs.hasOwnProp(options, "totalDecimal") ? options.totalDecimal : 2;
|
|
45
|
+
const endDecimal = chunkSYHPSOUU_cjs.hasOwnProp(options, "endDecimal") ? options.endDecimal : true;
|
|
46
|
+
const indianFormat = chunkSYHPSOUU_cjs.hasOwnProp(options, "indianFormat") ? options.indianFormat : false;
|
|
47
|
+
const suffixCurrency = chunkSYHPSOUU_cjs.hasOwnProp(options, "suffixCurrency") ? options.suffixCurrency : "";
|
|
48
|
+
const suffixDecimal = chunkSYHPSOUU_cjs.hasOwnProp(options, "suffixDecimal") ? options.suffixDecimal : "";
|
|
49
|
+
const roundedDecimal = chunkSYHPSOUU_cjs.hasOwnProp(options, "roundedDecimal") ? options.roundedDecimal : "round";
|
|
50
|
+
const negativeFormat = chunkSYHPSOUU_cjs.hasOwnProp(options, "negativeFormat") ? options.negativeFormat : "dash";
|
|
51
|
+
let separatorDecimals = chunkSYHPSOUU_cjs.hasOwnProp(options, "separatorDecimals") ? options.separatorDecimals : ",";
|
|
52
|
+
let separator = chunkSYHPSOUU_cjs.hasOwnProp(options, "separator") ? options.separator : ".";
|
|
53
|
+
if (!chunkSYHPSOUU_cjs.isString(separator) || !chunkSYHPSOUU_cjs.isString(separatorDecimals) || !chunkSYHPSOUU_cjs.isString(suffixCurrency) || !chunkSYHPSOUU_cjs.isString(suffixDecimal)) {
|
|
54
54
|
throw new TypeError(
|
|
55
|
-
`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${
|
|
55
|
+
`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
56
56
|
separator
|
|
57
|
-
)}\`, 'separatorDecimals': \`${
|
|
57
|
+
)}\`, 'separatorDecimals': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
58
58
|
separatorDecimals
|
|
59
|
-
)}\`, 'suffixCurrency': \`${
|
|
59
|
+
)}\`, 'suffixCurrency': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
60
60
|
suffixCurrency
|
|
61
|
-
)}\`, 'suffixDecimal': \`${
|
|
61
|
+
)}\`, 'suffixDecimal': \`${chunkSYHPSOUU_cjs.getPreciseType(suffixDecimal)}\`].`
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
if (!
|
|
64
|
+
if (!chunkSYHPSOUU_cjs.isBoolean(decimal) || !chunkSYHPSOUU_cjs.isBoolean(endDecimal) || !chunkSYHPSOUU_cjs.isBoolean(indianFormat)) {
|
|
65
65
|
throw new TypeError(
|
|
66
|
-
`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${
|
|
66
|
+
`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
67
67
|
decimal
|
|
68
|
-
)}\`, 'endDecimal': \`${
|
|
68
|
+
)}\`, 'endDecimal': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
69
69
|
endDecimal
|
|
70
|
-
)}\`, 'indianFormat': \`${
|
|
70
|
+
)}\`, 'indianFormat': \`${chunkSYHPSOUU_cjs.getPreciseType(indianFormat)}\`].`
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
if (!chunkDVMHRLKP_cjs.isInteger(totalDecimal)) {
|
|
74
74
|
throw new TypeError(
|
|
75
|
-
`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${
|
|
75
|
+
`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
76
76
|
totalDecimal
|
|
77
|
-
)}\`, with value: \`${
|
|
77
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(length, {
|
|
78
78
|
keepUndefined: true
|
|
79
79
|
})}\`.`
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
if (!(roundedDecimal === false || roundedDecimal === "round" || roundedDecimal === "ceil" || roundedDecimal === "floor")) {
|
|
83
83
|
throw new TypeError(
|
|
84
|
-
`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${
|
|
84
|
+
`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
85
85
|
roundedDecimal
|
|
86
|
-
)}\`, with value: \`${
|
|
86
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(roundedDecimal, {
|
|
87
87
|
keepUndefined: true
|
|
88
88
|
})}\`.`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
if (!(negativeFormat === "abs" || negativeFormat === "brackets" || negativeFormat === "dash" ||
|
|
91
|
+
if (!(negativeFormat === "abs" || negativeFormat === "brackets" || negativeFormat === "dash" || chunkSYHPSOUU_cjs.isPlainObject(negativeFormat))) {
|
|
92
92
|
throw new TypeError(
|
|
93
|
-
`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: \`${
|
|
93
|
+
`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: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
94
94
|
negativeFormat
|
|
95
|
-
)}\`, with value: \`${
|
|
95
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(negativeFormat, {
|
|
96
96
|
keepUndefined: true
|
|
97
97
|
})}\`.`
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
|
-
const rawNum =
|
|
101
|
-
if (
|
|
100
|
+
const rawNum = chunkSYHPSOUU_cjs.isString(value) ? chunkMUHRPRR7_cjs.parseCurrencyString(value) : value;
|
|
101
|
+
if (chunkSYHPSOUU_cjs.isNaN(rawNum)) {
|
|
102
102
|
throw new TypeError(
|
|
103
103
|
`First parameter (\`value\`) could not be parsed into a valid \`number\`.`
|
|
104
104
|
);
|
|
@@ -137,7 +137,7 @@ var formatCurrency = (value, options = {}) => {
|
|
|
137
137
|
} else {
|
|
138
138
|
formattedInteger = (suffixCurrency.trim().length ? suffixCurrency : "") + integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
139
139
|
}
|
|
140
|
-
if (decimal && !
|
|
140
|
+
if (decimal && !chunkSYHPSOUU_cjs.isUndefined(decimalPartRaw) && totalDecimal > 0) {
|
|
141
141
|
let formattedDecimal = separatorDecimals + decimalPartRaw;
|
|
142
142
|
if (endDecimal) formattedDecimal += suffixDecimal;
|
|
143
143
|
formattedInteger += formattedDecimal;
|
|
@@ -147,32 +147,32 @@ var formatCurrency = (value, options = {}) => {
|
|
|
147
147
|
formattedInteger = "-" + formattedInteger;
|
|
148
148
|
} else if (negativeFormat === "brackets") {
|
|
149
149
|
formattedInteger = "(" + formattedInteger + ")";
|
|
150
|
-
} else if (negativeFormat === "abs") ; else if (
|
|
151
|
-
if (
|
|
150
|
+
} else if (negativeFormat === "abs") ; else if (chunkSYHPSOUU_cjs.isPlainObject(negativeFormat)) {
|
|
151
|
+
if (chunkSYHPSOUU_cjs.hasOwnProp(negativeFormat, "custom")) {
|
|
152
152
|
const formatCustomNegative = negativeFormat.custom;
|
|
153
|
-
if (!
|
|
153
|
+
if (!chunkSYHPSOUU_cjs.isFunction(formatCustomNegative)) {
|
|
154
154
|
throw new TypeError(
|
|
155
|
-
`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${
|
|
155
|
+
`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
156
156
|
formatCustomNegative
|
|
157
157
|
)}\`.`
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
const result = formatCustomNegative(formattedInteger);
|
|
161
|
-
|
|
161
|
+
chunkWXFTVXBF_cjs.assertIsString(result, {
|
|
162
162
|
message: ({ currentType, validType }) => `Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${validType}\` type value, but received: \`${currentType}\`.`
|
|
163
163
|
});
|
|
164
164
|
formattedInteger = result;
|
|
165
165
|
} else {
|
|
166
166
|
const formatStyleNegative = negativeFormat.style || "dash";
|
|
167
|
-
const formatSpaceNegative = !
|
|
168
|
-
|
|
167
|
+
const formatSpaceNegative = !chunkSYHPSOUU_cjs.isUndefined(negativeFormat.space) ? negativeFormat.space : false;
|
|
168
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(formatSpaceNegative, {
|
|
169
169
|
message: ({ currentType, validType }) => `Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${validType} or undefined\`, but received: \`${currentType}\`.`
|
|
170
170
|
});
|
|
171
171
|
if (!(formatStyleNegative === "abs" || formatStyleNegative === "brackets" || formatStyleNegative === "dash")) {
|
|
172
172
|
throw new TypeError(
|
|
173
|
-
`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${
|
|
173
|
+
`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
174
174
|
formatStyleNegative
|
|
175
|
-
)}\`, with value: \`${
|
|
175
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(formatStyleNegative, {
|
|
176
176
|
keepUndefined: true
|
|
177
177
|
})}\`.`
|
|
178
178
|
);
|
|
@@ -192,21 +192,21 @@ var formatCurrency = (value, options = {}) => {
|
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
var formatNumber = (value, separator = ",") => {
|
|
195
|
-
if (!
|
|
195
|
+
if (!chunkSYHPSOUU_cjs.isString(value) && !chunkXX6RUGTM_cjs.isFinite(value)) {
|
|
196
196
|
throw new TypeError(
|
|
197
|
-
`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${
|
|
197
|
+
`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
198
198
|
value
|
|
199
199
|
)}\`.`
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
|
-
if (!
|
|
202
|
+
if (!chunkSYHPSOUU_cjs.isString(separator)) {
|
|
203
203
|
throw new TypeError(
|
|
204
|
-
`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${
|
|
204
|
+
`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
205
205
|
separator
|
|
206
206
|
)}\`.`
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
|
-
separator =
|
|
209
|
+
separator = chunkSYHPSOUU_cjs.isString(separator) ? separator : ",";
|
|
210
210
|
const decimalSeparator = separator === "." ? "," : separator === "," ? "." : ".";
|
|
211
211
|
const stringValue = value.toString().trim();
|
|
212
212
|
const lastDot = stringValue.lastIndexOf(".");
|
|
@@ -245,42 +245,42 @@ var isValidParseAsYouType = (parsedAsYouType) => {
|
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
function formatPhoneNumber(value, options = {}) {
|
|
248
|
-
if (
|
|
249
|
-
if (!
|
|
248
|
+
if (chunkSYHPSOUU_cjs.isNil(value)) return "";
|
|
249
|
+
if (!chunkSYHPSOUU_cjs.isString(value) && !chunkSYHPSOUU_cjs.isNumber(value)) {
|
|
250
250
|
throw new TypeError(
|
|
251
|
-
`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${
|
|
251
|
+
`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
252
252
|
value
|
|
253
253
|
)}\`.`
|
|
254
254
|
);
|
|
255
255
|
}
|
|
256
|
-
|
|
256
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
257
257
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
258
258
|
});
|
|
259
|
-
const takeNumberOnly =
|
|
260
|
-
const checkValidOnly =
|
|
261
|
-
const defaultCountry =
|
|
259
|
+
const takeNumberOnly = chunkSYHPSOUU_cjs.hasOwnProp(options, "takeNumberOnly") ? options.takeNumberOnly : false;
|
|
260
|
+
const checkValidOnly = chunkSYHPSOUU_cjs.hasOwnProp(options, "checkValidOnly") ? options.checkValidOnly : false;
|
|
261
|
+
const defaultCountry = chunkSYHPSOUU_cjs.hasOwnProp(
|
|
262
262
|
options,
|
|
263
263
|
"defaultCountry"
|
|
264
264
|
) ? options.defaultCountry : void 0;
|
|
265
|
-
const separator =
|
|
266
|
-
const prependPlusCountryCode =
|
|
267
|
-
const outputFormat =
|
|
268
|
-
const openingNumberCountry =
|
|
269
|
-
const closingNumberCountry =
|
|
270
|
-
if (!
|
|
265
|
+
const separator = chunkSYHPSOUU_cjs.hasOwnProp(options, "separator") ? options.separator : " ";
|
|
266
|
+
const prependPlusCountryCode = chunkSYHPSOUU_cjs.hasOwnProp(options, "prependPlusCountryCode") ? options.prependPlusCountryCode : true;
|
|
267
|
+
const outputFormat = chunkSYHPSOUU_cjs.hasOwnProp(options, "outputFormat") ? options.outputFormat : "INTERNATIONAL";
|
|
268
|
+
const openingNumberCountry = chunkSYHPSOUU_cjs.hasOwnProp(options, "openingNumberCountry") ? options.openingNumberCountry : "";
|
|
269
|
+
const closingNumberCountry = chunkSYHPSOUU_cjs.hasOwnProp(options, "closingNumberCountry") ? options.closingNumberCountry : "";
|
|
270
|
+
if (!chunkSYHPSOUU_cjs.isBoolean(takeNumberOnly) || !chunkSYHPSOUU_cjs.isBoolean(checkValidOnly) || !chunkSYHPSOUU_cjs.isBoolean(prependPlusCountryCode)) {
|
|
271
271
|
throw new TypeError(
|
|
272
|
-
`Parameter \`takeNumberOnly\`, \`checkValidOnly\` and \`prependPlusCountryCode\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${
|
|
272
|
+
`Parameter \`takeNumberOnly\`, \`checkValidOnly\` and \`prependPlusCountryCode\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
273
273
|
takeNumberOnly
|
|
274
|
-
)}\`, 'checkValidOnly': \`${
|
|
274
|
+
)}\`, 'checkValidOnly': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
275
275
|
checkValidOnly
|
|
276
|
-
)}\`, 'prependPlusCountryCode': \`${
|
|
276
|
+
)}\`, 'prependPlusCountryCode': \`${chunkSYHPSOUU_cjs.getPreciseType(prependPlusCountryCode)}\`].`
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
|
-
if (!
|
|
279
|
+
if (!chunkSYHPSOUU_cjs.isUndefined(defaultCountry) && !max.isSupportedCountry(defaultCountry)) {
|
|
280
280
|
throw new TypeError(
|
|
281
|
-
`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: \`${
|
|
281
|
+
`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: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
282
282
|
defaultCountry
|
|
283
|
-
)}\`, with value: \`${
|
|
283
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(defaultCountry, {
|
|
284
284
|
keepUndefined: true
|
|
285
285
|
})}\`.
|
|
286
286
|
|
|
@@ -289,21 +289,21 @@ See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_e
|
|
|
289
289
|
}
|
|
290
290
|
if (!["INTERNATIONAL", "NATIONAL", "RFC3966", "E.164"].includes(outputFormat)) {
|
|
291
291
|
throw new TypeError(
|
|
292
|
-
`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: \`${
|
|
292
|
+
`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: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
293
293
|
outputFormat
|
|
294
|
-
)}\`, with value: ${
|
|
294
|
+
)}\`, with value: ${chunkDAPAK2W3_cjs.safeStableStringify(outputFormat, { keepUndefined: true })}.`
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
|
-
if (!
|
|
297
|
+
if (!chunkSYHPSOUU_cjs.isString(separator) || !chunkSYHPSOUU_cjs.isString(openingNumberCountry) || !chunkSYHPSOUU_cjs.isString(closingNumberCountry)) {
|
|
298
298
|
throw new TypeError(
|
|
299
|
-
`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': \`${
|
|
299
|
+
`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': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
300
300
|
separator
|
|
301
|
-
)}\`,'openingNumberCountry': \`${
|
|
301
|
+
)}\`,'openingNumberCountry': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
302
302
|
openingNumberCountry
|
|
303
|
-
)}\`, 'closingNumberCountry': \`${
|
|
303
|
+
)}\`, 'closingNumberCountry': \`${chunkSYHPSOUU_cjs.getPreciseType(closingNumberCountry)}\`].`
|
|
304
304
|
);
|
|
305
305
|
}
|
|
306
|
-
if (!
|
|
306
|
+
if (!chunkSYHPSOUU_cjs.isString(value)) value = String(value);
|
|
307
307
|
const parsedPhoneNumber = parsingAsYouType(value, defaultCountry);
|
|
308
308
|
const validPhoneNumber = isValidParseAsYouType(parsedPhoneNumber);
|
|
309
309
|
if (checkValidOnly) return validPhoneNumber;
|
|
@@ -317,7 +317,7 @@ See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_e
|
|
|
317
317
|
const [cc, ...rest] = intlNumb.split(" ");
|
|
318
318
|
const countryCode = prependPlusCountryCode ? cc : cc.replace(/^\++/, "");
|
|
319
319
|
const restWithSeparator = rest.join(separator);
|
|
320
|
-
if (
|
|
320
|
+
if (chunkSYHPSOUU_cjs.isNonEmptyString(openingNumberCountry) && chunkSYHPSOUU_cjs.isNonEmptyString(closingNumberCountry)) {
|
|
321
321
|
return `${openingNumberCountry}${countryCode}${closingNumberCountry} ${restWithSeparator}`;
|
|
322
322
|
}
|
|
323
323
|
return `${countryCode} ${restWithSeparator}`;
|
|
@@ -347,7 +347,7 @@ var _censor = (str, minCensor, maxPercentage, hashSeed) => {
|
|
|
347
347
|
const indexes = /* @__PURE__ */ new Set();
|
|
348
348
|
let i = 0;
|
|
349
349
|
while (indexes.size < totalCensor) {
|
|
350
|
-
const idx = !
|
|
350
|
+
const idx = !chunkSYHPSOUU_cjs.isUndefined(hashSeed) ? (hashSeed + str.length + i * 31) % str.length : Math.floor(Math.random() * str.length);
|
|
351
351
|
indexes.add(idx);
|
|
352
352
|
i++;
|
|
353
353
|
}
|
|
@@ -358,16 +358,16 @@ var _censor = (str, minCensor, maxPercentage, hashSeed) => {
|
|
|
358
358
|
};
|
|
359
359
|
|
|
360
360
|
var censorEmail = (email, options = {}) => {
|
|
361
|
-
if (!
|
|
362
|
-
|
|
361
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(email)) return "";
|
|
362
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
363
363
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
364
364
|
});
|
|
365
|
-
const mode =
|
|
365
|
+
const mode = chunkSYHPSOUU_cjs.hasOwnProp(options, "mode") ? options.mode : "fixed";
|
|
366
366
|
if (mode !== "random" && mode !== "fixed") {
|
|
367
367
|
throw new TypeError(
|
|
368
|
-
`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${
|
|
368
|
+
`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
369
369
|
mode
|
|
370
|
-
)}\`, with value: \`${
|
|
370
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(mode, {
|
|
371
371
|
keepUndefined: true
|
|
372
372
|
})}\`.`
|
|
373
373
|
);
|
|
@@ -389,31 +389,31 @@ var censorEmail = (email, options = {}) => {
|
|
|
389
389
|
};
|
|
390
390
|
|
|
391
391
|
function chunkString(subject, limiter, options = {}) {
|
|
392
|
-
if (
|
|
393
|
-
|
|
392
|
+
if (chunkSYHPSOUU_cjs.isNil(subject) || limiter <= 0) return subject;
|
|
393
|
+
chunkWXFTVXBF_cjs.assertIsString(subject, {
|
|
394
394
|
message: ({ currentType, validType }) => `First parameter (\`subject\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
395
395
|
});
|
|
396
396
|
if (!chunkDVMHRLKP_cjs.isInteger(limiter)) {
|
|
397
397
|
throw new TypeError(
|
|
398
|
-
`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${
|
|
398
|
+
`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
399
399
|
limiter
|
|
400
|
-
)}\`, with value: \`${
|
|
400
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(limiter, {
|
|
401
401
|
keepUndefined: true
|
|
402
402
|
})}\`.`
|
|
403
403
|
);
|
|
404
404
|
}
|
|
405
|
-
|
|
405
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
406
406
|
message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
407
407
|
});
|
|
408
|
-
const separator =
|
|
409
|
-
const reCountAfterSpace =
|
|
410
|
-
|
|
408
|
+
const separator = chunkSYHPSOUU_cjs.hasOwnProp(options, "separator") ? options.separator : " ";
|
|
409
|
+
const reCountAfterSpace = chunkSYHPSOUU_cjs.hasOwnProp(options, "reCountAfterSpace") ? options.reCountAfterSpace : false;
|
|
410
|
+
chunkWXFTVXBF_cjs.assertIsString(separator, {
|
|
411
411
|
message: ({ currentType, validType }) => `Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
412
412
|
});
|
|
413
|
-
|
|
413
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(reCountAfterSpace, {
|
|
414
414
|
message: ({ currentType, validType }) => `Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
415
415
|
});
|
|
416
|
-
subject =
|
|
416
|
+
subject = chunkBMZZXZJ2_cjs.normalizeSpaces(subject);
|
|
417
417
|
if (!reCountAfterSpace) {
|
|
418
418
|
let result = "";
|
|
419
419
|
let currentCount = 0;
|
|
@@ -456,30 +456,30 @@ function chunkString(subject, limiter, options = {}) {
|
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
var truncateString = (text, options = {}) => {
|
|
459
|
-
if (!
|
|
460
|
-
|
|
459
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(text)) return "";
|
|
460
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
461
461
|
message: ({ currentType, validType }) => `Seconds parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
462
462
|
});
|
|
463
|
-
const trim =
|
|
464
|
-
const length2 =
|
|
465
|
-
let ending =
|
|
463
|
+
const trim = chunkSYHPSOUU_cjs.hasOwnProp(options, "trim") ? options.trim : true;
|
|
464
|
+
const length2 = chunkSYHPSOUU_cjs.hasOwnProp(options, "length") ? options.length : 10;
|
|
465
|
+
let ending = chunkSYHPSOUU_cjs.hasOwnProp(options, "ending") ? options.ending : "...";
|
|
466
466
|
if (!chunkDVMHRLKP_cjs.isInteger(length2)) {
|
|
467
467
|
throw new TypeError(
|
|
468
|
-
`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${
|
|
468
|
+
`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
469
469
|
length2
|
|
470
|
-
)}\`, with value: \`${
|
|
470
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(length2, {
|
|
471
471
|
keepUndefined: true
|
|
472
472
|
})}\`.`
|
|
473
473
|
);
|
|
474
474
|
}
|
|
475
475
|
if (length2 < 1) return "";
|
|
476
|
-
|
|
476
|
+
chunkWXFTVXBF_cjs.assertIsString(ending, {
|
|
477
477
|
message: ({ currentType, validType }) => `Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
478
478
|
});
|
|
479
|
-
|
|
479
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(trim, {
|
|
480
480
|
message: ({ currentType, validType }) => `Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
481
481
|
});
|
|
482
|
-
if (
|
|
482
|
+
if (chunkWLOQQFDS_cjs.isEmptyString(ending)) {
|
|
483
483
|
ending = "...";
|
|
484
484
|
} else {
|
|
485
485
|
ending = ending.trim();
|
|
@@ -492,24 +492,24 @@ var truncateString = (text, options = {}) => {
|
|
|
492
492
|
return cleanSliced + ending;
|
|
493
493
|
};
|
|
494
494
|
var formatDateFns = (date, options = {}) => {
|
|
495
|
-
if (
|
|
496
|
-
if (!
|
|
495
|
+
if (chunkSYHPSOUU_cjs.isNil(date) || !(chunkDAPAK2W3_cjs.isDate(date) || chunkSYHPSOUU_cjs.isNonEmptyString(date))) return null;
|
|
496
|
+
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
497
497
|
options = {};
|
|
498
498
|
}
|
|
499
499
|
const { inputFormat, locale: locale$1 = "en", inputLocale = "en", ...restOptions } = options;
|
|
500
|
-
const format =
|
|
500
|
+
const format = chunkSYHPSOUU_cjs.hasOwnProp(options, "format") && chunkSYHPSOUU_cjs.isNonEmptyString(options.format) ? options.format : "dd MMM yyyy - HH:mm:ss";
|
|
501
501
|
let parsedDate;
|
|
502
502
|
try {
|
|
503
|
-
if (
|
|
504
|
-
const valueOfInputLocale =
|
|
503
|
+
if (chunkSYHPSOUU_cjs.isNonEmptyString(date) && inputFormat && inputLocale) {
|
|
504
|
+
const valueOfInputLocale = chunkSYHPSOUU_cjs.isNonEmptyString(inputLocale) ? inputLocale === "id" ? locale.id : locale.enUS : inputLocale;
|
|
505
505
|
parsedDate = dateFns.parse(date, inputFormat, /* @__PURE__ */ new Date(), {
|
|
506
506
|
locale: valueOfInputLocale
|
|
507
507
|
});
|
|
508
508
|
} else {
|
|
509
509
|
parsedDate = new Date(date);
|
|
510
510
|
}
|
|
511
|
-
if (
|
|
512
|
-
const valueOfLocale =
|
|
511
|
+
if (chunkSYHPSOUU_cjs.isNaN(parsedDate.getTime())) return null;
|
|
512
|
+
const valueOfLocale = chunkSYHPSOUU_cjs.isNonEmptyString(locale$1) ? locale$1 === "id" ? locale.id : locale.enUS : locale$1;
|
|
513
513
|
return dateFns.format(parsedDate, format, {
|
|
514
514
|
...restOptions,
|
|
515
515
|
locale: valueOfLocale
|
|
@@ -520,16 +520,16 @@ var formatDateFns = (date, options = {}) => {
|
|
|
520
520
|
};
|
|
521
521
|
|
|
522
522
|
var formatDateIntl = (date, options) => {
|
|
523
|
-
if (
|
|
523
|
+
if (chunkSYHPSOUU_cjs.isNil(date) || !(chunkDAPAK2W3_cjs.isDate(date) || chunkSYHPSOUU_cjs.isNonEmptyString(date))) return null;
|
|
524
524
|
const parsedDate = new Date(date);
|
|
525
|
-
if (
|
|
526
|
-
if (!
|
|
525
|
+
if (chunkSYHPSOUU_cjs.isNaN(parsedDate.getTime())) return null;
|
|
526
|
+
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
527
527
|
options = {};
|
|
528
528
|
}
|
|
529
529
|
const { locale = "en-US", ...restProps } = options;
|
|
530
530
|
try {
|
|
531
531
|
return new Intl.DateTimeFormat(
|
|
532
|
-
|
|
532
|
+
chunkSYHPSOUU_cjs.isNonEmptyString(locale) ? locale.trim() : "en-US",
|
|
533
533
|
restProps
|
|
534
534
|
).format(parsedDate);
|
|
535
535
|
} catch {
|
|
@@ -538,16 +538,16 @@ var formatDateIntl = (date, options) => {
|
|
|
538
538
|
};
|
|
539
539
|
|
|
540
540
|
var formatDateTime = (date, format) => {
|
|
541
|
-
if (
|
|
541
|
+
if (chunkSYHPSOUU_cjs.isNil(format)) {
|
|
542
542
|
format = "YYYY-MM-DD hh:mm:ss";
|
|
543
543
|
}
|
|
544
|
-
if (!
|
|
545
|
-
if (
|
|
544
|
+
if (!chunkSYHPSOUU_cjs.isString(format)) return null;
|
|
545
|
+
if (chunkSYHPSOUU_cjs.isNil(date) || !(chunkDAPAK2W3_cjs.isDate(date) || chunkSYHPSOUU_cjs.isNonEmptyString(date))) {
|
|
546
546
|
return null;
|
|
547
547
|
}
|
|
548
548
|
try {
|
|
549
549
|
const parsedDate = new Date(date);
|
|
550
|
-
if (
|
|
550
|
+
if (chunkSYHPSOUU_cjs.isNaN(parsedDate.getTime())) return null;
|
|
551
551
|
const pad2 = (n) => n.toString().padStart(2, "0");
|
|
552
552
|
const map = {
|
|
553
553
|
YYYY: parsedDate.getFullYear().toString(),
|
|
@@ -569,13 +569,13 @@ var formatDateTime = (date, format) => {
|
|
|
569
569
|
|
|
570
570
|
var getGMTOffset = (date) => {
|
|
571
571
|
try {
|
|
572
|
-
if (
|
|
572
|
+
if (chunkSYHPSOUU_cjs.isNil(date) || chunkSYHPSOUU_cjs.isString(date) && chunkWLOQQFDS_cjs.isEmptyString(date)) {
|
|
573
573
|
date = /* @__PURE__ */ new Date();
|
|
574
|
-
} else if (!(
|
|
574
|
+
} else if (!(chunkDAPAK2W3_cjs.isDate(date) || chunkSYHPSOUU_cjs.isNonEmptyString(date))) {
|
|
575
575
|
return "0";
|
|
576
576
|
}
|
|
577
577
|
const parsedDate = new Date(date);
|
|
578
|
-
if (
|
|
578
|
+
if (chunkSYHPSOUU_cjs.isNaN(parsedDate.getTime())) return "0";
|
|
579
579
|
const padZero = (num) => num.toString().padStart(2, "0");
|
|
580
580
|
let offset = parsedDate.getTimezoneOffset();
|
|
581
581
|
const sign = offset < 0 ? "+" : "-";
|