bn-calendar 1.2.1 → 1.2.2
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/convert-BetQIRvF.cjs +128 -0
- package/dist/convert-CYpIfNZ_.mjs +80 -0
- package/dist/index.cjs +1102 -1
- package/dist/index.mjs +1099 -1
- package/dist/types.mjs +1 -1
- package/dist/utils.cjs +5 -1
- package/dist/utils.mjs +3 -1
- package/package.json +4 -1
- package/dist/convert-3jw8Rx7e.cjs +0 -1
- package/dist/convert-Byg6yAIU.mjs +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
|
|
2
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
3
|
+
function isNumber(value) {
|
|
4
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
5
|
+
}
|
|
6
|
+
function isString(value) {
|
|
7
|
+
return typeof value === "string";
|
|
8
|
+
}
|
|
9
|
+
function isInteger(value) {
|
|
10
|
+
return isNumber(value) && Number.isInteger(value);
|
|
11
|
+
}
|
|
12
|
+
function isNonEmptyString(value) {
|
|
13
|
+
return isString(value) && value?.length > 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
18
|
+
function isArray(value) {
|
|
19
|
+
return Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
function isObject(value) {
|
|
22
|
+
return value !== null && typeof value === "object" && !isArray(value);
|
|
23
|
+
}
|
|
24
|
+
function isObjectWithKeys(value, keys) {
|
|
25
|
+
return isObject(value) && keys?.every((key) => key in value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/specials.js
|
|
30
|
+
function isDateString(value) {
|
|
31
|
+
return isString(value) && !isNaN(Date.parse(value));
|
|
32
|
+
}
|
|
33
|
+
function isNumericString(value) {
|
|
34
|
+
return isString(value) && value?.trim() !== "" && Number.isFinite(Number(value));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/constants.js
|
|
39
|
+
const BN_DIGITS = /* @__PURE__ */ Object.freeze({
|
|
40
|
+
"০": 0,
|
|
41
|
+
"১": 1,
|
|
42
|
+
"২": 2,
|
|
43
|
+
"৩": 3,
|
|
44
|
+
"৪": 4,
|
|
45
|
+
"৫": 5,
|
|
46
|
+
"৬": 6,
|
|
47
|
+
"৭": 7,
|
|
48
|
+
"৮": 8,
|
|
49
|
+
"৯": 9
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/utilities.js
|
|
54
|
+
function normalizeNumber(num) {
|
|
55
|
+
return isNumber(num) ? num : isNumericString(num) ? Number(num) : void 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/convert.js
|
|
60
|
+
function banglaToDigit(bnDigit, forceNumber = true) {
|
|
61
|
+
if (!isNonEmptyString(bnDigit)) return forceNumber ? NaN : "";
|
|
62
|
+
const digitStr = bnDigit.replace(/[০১২৩৪৫৬৭৮৯]/g, (d) => String(BN_DIGITS[d]));
|
|
63
|
+
if (forceNumber) return Number(digitStr.split("").filter((dig) => !isNaN(Number(dig))).join(""));
|
|
64
|
+
return digitStr;
|
|
65
|
+
}
|
|
66
|
+
function digitToBangla(digit, preserveNonDigit = true) {
|
|
67
|
+
const banglaDigits = Object.keys(BN_DIGITS);
|
|
68
|
+
const _matchAndConvert = (value) => {
|
|
69
|
+
return value.replace(/\d/g, (dig) => banglaDigits[Number(dig)]);
|
|
70
|
+
};
|
|
71
|
+
if (isNumber(digit)) return _matchAndConvert(String(digit));
|
|
72
|
+
if (isNonEmptyString(digit)) {
|
|
73
|
+
const bnDigStr = _matchAndConvert(digit);
|
|
74
|
+
if (preserveNonDigit || isNumericString(digit)) return bnDigStr;
|
|
75
|
+
return bnDigStr.split("").filter((dig) => banglaDigits.includes(dig)).join("");
|
|
76
|
+
}
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
Object.defineProperty(exports, 'banglaToDigit', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () {
|
|
84
|
+
return banglaToDigit;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, 'digitToBangla', {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return digitToBangla;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, 'isDateString', {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function () {
|
|
96
|
+
return isDateString;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(exports, 'isInteger', {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () {
|
|
102
|
+
return isInteger;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(exports, 'isNonEmptyString', {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () {
|
|
108
|
+
return isNonEmptyString;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, 'isNumber', {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () {
|
|
114
|
+
return isNumber;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(exports, 'isObjectWithKeys', {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function () {
|
|
120
|
+
return isObjectWithKeys;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(exports, 'normalizeNumber', {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () {
|
|
126
|
+
return normalizeNumber;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
2
|
+
function isNumber(value) {
|
|
3
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
4
|
+
}
|
|
5
|
+
function isString(value) {
|
|
6
|
+
return typeof value === "string";
|
|
7
|
+
}
|
|
8
|
+
function isInteger(value) {
|
|
9
|
+
return isNumber(value) && Number.isInteger(value);
|
|
10
|
+
}
|
|
11
|
+
function isNonEmptyString(value) {
|
|
12
|
+
return isString(value) && value?.length > 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
17
|
+
function isArray(value) {
|
|
18
|
+
return Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function isObject(value) {
|
|
21
|
+
return value !== null && typeof value === "object" && !isArray(value);
|
|
22
|
+
}
|
|
23
|
+
function isObjectWithKeys(value, keys) {
|
|
24
|
+
return isObject(value) && keys?.every((key) => key in value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/specials.js
|
|
29
|
+
function isDateString(value) {
|
|
30
|
+
return isString(value) && !isNaN(Date.parse(value));
|
|
31
|
+
}
|
|
32
|
+
function isNumericString(value) {
|
|
33
|
+
return isString(value) && value?.trim() !== "" && Number.isFinite(Number(value));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/constants.js
|
|
38
|
+
const BN_DIGITS = /* @__PURE__ */ Object.freeze({
|
|
39
|
+
"০": 0,
|
|
40
|
+
"১": 1,
|
|
41
|
+
"২": 2,
|
|
42
|
+
"৩": 3,
|
|
43
|
+
"৪": 4,
|
|
44
|
+
"৫": 5,
|
|
45
|
+
"৬": 6,
|
|
46
|
+
"৭": 7,
|
|
47
|
+
"৮": 8,
|
|
48
|
+
"৯": 9
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/utilities.js
|
|
53
|
+
function normalizeNumber(num) {
|
|
54
|
+
return isNumber(num) ? num : isNumericString(num) ? Number(num) : void 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/number/convert.js
|
|
59
|
+
function banglaToDigit(bnDigit, forceNumber = true) {
|
|
60
|
+
if (!isNonEmptyString(bnDigit)) return forceNumber ? NaN : "";
|
|
61
|
+
const digitStr = bnDigit.replace(/[০১২৩৪৫৬৭৮৯]/g, (d) => String(BN_DIGITS[d]));
|
|
62
|
+
if (forceNumber) return Number(digitStr.split("").filter((dig) => !isNaN(Number(dig))).join(""));
|
|
63
|
+
return digitStr;
|
|
64
|
+
}
|
|
65
|
+
function digitToBangla(digit, preserveNonDigit = true) {
|
|
66
|
+
const banglaDigits = Object.keys(BN_DIGITS);
|
|
67
|
+
const _matchAndConvert = (value) => {
|
|
68
|
+
return value.replace(/\d/g, (dig) => banglaDigits[Number(dig)]);
|
|
69
|
+
};
|
|
70
|
+
if (isNumber(digit)) return _matchAndConvert(String(digit));
|
|
71
|
+
if (isNonEmptyString(digit)) {
|
|
72
|
+
const bnDigStr = _matchAndConvert(digit);
|
|
73
|
+
if (preserveNonDigit || isNumericString(digit)) return bnDigStr;
|
|
74
|
+
return bnDigStr.split("").filter((dig) => banglaDigits.includes(dig)).join("");
|
|
75
|
+
}
|
|
76
|
+
return "";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { isObjectWithKeys as a, isNumber as c, isDateString as i, digitToBangla as n, isInteger as o, normalizeNumber as r, isNonEmptyString as s, banglaToDigit as t };
|