chronos-date 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/dist/constants.d.mts +1 -1
- package/dist/convert-C8LsoKmI-Blf3eLS6.mjs +285 -0
- package/dist/convert-C8LsoKmI-uBhT5hZQ.cjs +387 -0
- package/dist/dist-BPHYJA0t.mjs +70 -0
- package/dist/dist-CdMlZMZa.cjs +75 -0
- package/dist/{greet-DNGvP7nm.mjs → greet-BC86-X9W.mjs} +2 -2
- package/dist/{greet-CMkwXJ7o.cjs → greet-Brz0CVv1.cjs} +8 -8
- package/dist/guards-DTI799nG.mjs +46 -0
- package/dist/guards-dH9JJIso.cjs +51 -0
- package/dist/guards.cjs +14 -16
- package/dist/guards.d.cts +1 -1
- package/dist/guards.d.mts +1 -1
- package/dist/guards.mjs +1 -3
- package/dist/{helpers-Bq7Hczoa.cjs → helpers-BMDeRLjO.cjs} +6 -8
- package/dist/{helpers-C2spzGZ-.mjs → helpers-t49KkxOE.mjs} +2 -4
- package/dist/index.cjs +13 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -5
- package/dist/plugins/banglaPlugin.cjs +16 -33
- package/dist/plugins/banglaPlugin.d.cts +1 -1
- package/dist/plugins/banglaPlugin.d.mts +1 -1
- package/dist/plugins/banglaPlugin.mjs +2 -19
- package/dist/plugins/businessPlugin.cjs +4 -5
- package/dist/plugins/businessPlugin.d.cts +1 -1
- package/dist/plugins/businessPlugin.d.mts +1 -1
- package/dist/plugins/businessPlugin.mjs +1 -2
- package/dist/plugins/dateRangePlugin.cjs +4 -5
- package/dist/plugins/dateRangePlugin.d.cts +1 -1
- package/dist/plugins/dateRangePlugin.d.mts +1 -1
- package/dist/plugins/dateRangePlugin.mjs +1 -2
- package/dist/plugins/dayPartPlugin.cjs +2 -2
- package/dist/plugins/dayPartPlugin.d.cts +1 -1
- package/dist/plugins/dayPartPlugin.d.mts +1 -1
- package/dist/plugins/dayPartPlugin.mjs +1 -1
- package/dist/plugins/durationPlugin.d.cts +1 -1
- package/dist/plugins/durationPlugin.d.mts +1 -1
- package/dist/plugins/fromNowPlugin.cjs +2 -2
- package/dist/plugins/fromNowPlugin.d.cts +1 -1
- package/dist/plugins/fromNowPlugin.d.mts +1 -1
- package/dist/plugins/fromNowPlugin.mjs +1 -1
- package/dist/plugins/greetingPlugin.cjs +1 -1
- package/dist/plugins/greetingPlugin.d.cts +1 -1
- package/dist/plugins/greetingPlugin.d.mts +1 -1
- package/dist/plugins/greetingPlugin.mjs +1 -1
- package/dist/plugins/palindromePlugin.cjs +2 -9
- package/dist/plugins/palindromePlugin.d.cts +1 -1
- package/dist/plugins/palindromePlugin.d.mts +1 -1
- package/dist/plugins/palindromePlugin.mjs +1 -8
- package/dist/plugins/relativeTimePlugin.d.cts +1 -1
- package/dist/plugins/relativeTimePlugin.d.mts +1 -1
- package/dist/plugins/roundPlugin.cjs +8 -8
- package/dist/plugins/roundPlugin.d.cts +1 -1
- package/dist/plugins/roundPlugin.d.mts +1 -1
- package/dist/plugins/roundPlugin.mjs +1 -1
- package/dist/plugins/seasonPlugin.d.cts +1 -1
- package/dist/plugins/seasonPlugin.d.mts +1 -1
- package/dist/plugins/timeZonePlugin.cjs +3 -3
- package/dist/plugins/timeZonePlugin.d.cts +1 -1
- package/dist/plugins/timeZonePlugin.d.mts +1 -1
- package/dist/plugins/timeZonePlugin.mjs +2 -2
- package/dist/plugins/zodiacPlugin.cjs +1 -1
- package/dist/plugins/zodiacPlugin.d.cts +1 -1
- package/dist/plugins/zodiacPlugin.d.mts +1 -1
- package/dist/plugins/zodiacPlugin.mjs +1 -1
- package/dist/{types-Be4ZMpOV.d.mts → types-CiFnGEL8.d.mts} +967 -902
- package/dist/{types-dNpvroNQ.d.cts → types-zhhEJ8N7.d.cts} +966 -901
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/{utilities-C6NiChRE.mjs → utils-DBy7S7hH.mjs} +3 -5
- package/dist/{utilities-CCnKWAsS.cjs → utils-S_aw0TeC.cjs} +8 -10
- package/dist/utils.cjs +33 -34
- package/dist/utils.d.cts +4 -4
- package/dist/utils.d.mts +4 -4
- package/dist/utils.mjs +4 -5
- package/package.json +3 -3
- package/dist/convert-BDQBTK5P.cjs +0 -49
- package/dist/convert-D5Cd0cCg.mjs +0 -38
- package/dist/non-primitives-BqjRwK2B.cjs +0 -68
- package/dist/non-primitives-CbAOB6lb.mjs +0 -38
- package/dist/primitives-BXhrgs9R.mjs +0 -35
- package/dist/primitives-DfO90c3G.cjs +0 -65
- package/dist/utilities-BnHD2hHf.mjs +0 -59
- package/dist/utilities-C_KmjIRK.cjs +0 -88
- /package/dist/{seasons-B_kjFWIX.d.mts → seasons-DYk2jvtn.d.mts} +0 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/primitives-Djsevc69.mjs
|
|
19
|
+
/**
|
|
20
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
21
|
+
*
|
|
22
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License.
|
|
24
|
+
* You may obtain a copy of the License at
|
|
25
|
+
*
|
|
26
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
*
|
|
28
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
29
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
30
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
+
* See the License for the specific language governing permissions and
|
|
32
|
+
* limitations under the License.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* * Type guard to check whether a value is a finite number (excluding `NaN` and `Infinity`).
|
|
36
|
+
* @param value - The value to test.
|
|
37
|
+
* @returns `true` if the value is a finite number; otherwise `false`.
|
|
38
|
+
*/
|
|
39
|
+
function isNumber(value) {
|
|
40
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* * Type guard to check if a value is a string.
|
|
44
|
+
* @param value - The value to check.
|
|
45
|
+
* @returns `true` if the value is a string, otherwise `false`.
|
|
46
|
+
*/
|
|
47
|
+
function isString(value) {
|
|
48
|
+
return typeof value === "string";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* * Type guard to check if a value is a boolean.
|
|
52
|
+
* @param value - The value to check.
|
|
53
|
+
* @returns `true` if the value is a boolean, otherwise `false`.
|
|
54
|
+
*/
|
|
55
|
+
function isBoolean(value) {
|
|
56
|
+
return typeof value === "boolean";
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* * Type guard to check if a value is undefined.
|
|
60
|
+
* @param value - The value to check.
|
|
61
|
+
* @returns `true` if the value is undefined, otherwise `false`.
|
|
62
|
+
*/
|
|
63
|
+
function isUndefined(value) {
|
|
64
|
+
return value === void 0;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* * Type guard to check if a value is a non-empty string.
|
|
68
|
+
* @param value - The value to check.
|
|
69
|
+
* @returns `true` if the value is a non-empty string, otherwise `false`.
|
|
70
|
+
*/
|
|
71
|
+
function isNonEmptyString(value) {
|
|
72
|
+
return isString(value) && value?.length > 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/constants-ZyfpysiQ.mjs
|
|
77
|
+
/** * Bangla digits from `০-৯` mapped against `0-9` */
|
|
78
|
+
const BN_DIGITS = /* @__PURE__ */ Object.freeze({
|
|
79
|
+
"০": 0,
|
|
80
|
+
"১": 1,
|
|
81
|
+
"২": 2,
|
|
82
|
+
"৩": 3,
|
|
83
|
+
"৪": 4,
|
|
84
|
+
"৫": 5,
|
|
85
|
+
"৬": 6,
|
|
86
|
+
"৭": 7,
|
|
87
|
+
"৮": 8,
|
|
88
|
+
"৯": 9
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/specials-Cye93-uo.mjs
|
|
93
|
+
/**
|
|
94
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
95
|
+
*
|
|
96
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
97
|
+
* you may not use this file except in compliance with the License.
|
|
98
|
+
* You may obtain a copy of the License at
|
|
99
|
+
*
|
|
100
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
*
|
|
102
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
103
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
104
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
105
|
+
* See the License for the specific language governing permissions and
|
|
106
|
+
* limitations under the License.
|
|
107
|
+
*/
|
|
108
|
+
/**
|
|
109
|
+
* * Type guard to check if a value is an array.
|
|
110
|
+
* @param value - The value to check.
|
|
111
|
+
* @returns `true` if the value is an array, otherwise `false`.
|
|
112
|
+
*/
|
|
113
|
+
function isArray(value) {
|
|
114
|
+
return Array.isArray(value);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* * Type guard to check if a value is an array with length.
|
|
118
|
+
* @param value - The value to check.
|
|
119
|
+
* @returns `true` if the value is an array with length, otherwise `false`.
|
|
120
|
+
*/
|
|
121
|
+
function isValidArray(value) {
|
|
122
|
+
return Array.isArray(value) && value?.length > 0;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* * Type guard to check if a value is an object (excluding null).
|
|
126
|
+
* @param value - The value to check.
|
|
127
|
+
* @returns `true` if the value is an object, otherwise `false`.
|
|
128
|
+
*/
|
|
129
|
+
function isObject(value) {
|
|
130
|
+
return value !== null && typeof value === "object" && !isArray(value);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* * Type guard to check if a value is an object (excluding null) and has keys in it.
|
|
134
|
+
* @param value - The value to check.
|
|
135
|
+
* @returns `true` if the value is an object with valid keys, otherwise `false`.
|
|
136
|
+
*/
|
|
137
|
+
function isNotEmptyObject(value) {
|
|
138
|
+
return isObject(value) && Object.keys(value)?.length > 0;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* * Type guard to check if a value is an object with specific keys.
|
|
142
|
+
* @param value - The value to check.
|
|
143
|
+
* @param keys - The list of keys the object should contain.
|
|
144
|
+
* @returns `true` if the value is an object with the specified keys, otherwise `false`.
|
|
145
|
+
*/
|
|
146
|
+
function isObjectWithKeys(value, keys) {
|
|
147
|
+
return isObject(value) && keys?.every((key) => key in value);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* * Type guard to check if a value is a function.
|
|
151
|
+
* @param value - The value to check.
|
|
152
|
+
* @returns `true` if the value is a function, otherwise `false`.
|
|
153
|
+
*/
|
|
154
|
+
function isFunction(value) {
|
|
155
|
+
return typeof value === "function";
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* * Type guard to check if a value is a string representing a finite number.
|
|
159
|
+
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* - Accepts strings like: `"42"`, `" -5.5 "`, `"0.123"`, `"-0"`, `"1e5"`.
|
|
162
|
+
* - Rejects strings like: `"NaN"`, `"Infinity"`, `"-Infinity"`, `"abc"`, `""`, `"42abc"`.
|
|
163
|
+
*
|
|
164
|
+
* @param value - The value to test.
|
|
165
|
+
* @returns `true` if the value is a string that fully represents a finite number.
|
|
166
|
+
*/
|
|
167
|
+
function isNumericString(value) {
|
|
168
|
+
return isString(value) && value?.trim() !== "" && Number.isFinite(Number(value));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/utilities-B9axOvOX.mjs
|
|
173
|
+
/**
|
|
174
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
175
|
+
*
|
|
176
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
177
|
+
* you may not use this file except in compliance with the License.
|
|
178
|
+
* You may obtain a copy of the License at
|
|
179
|
+
*
|
|
180
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
181
|
+
*
|
|
182
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
183
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
184
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
185
|
+
* See the License for the specific language governing permissions and
|
|
186
|
+
* limitations under the License.
|
|
187
|
+
*/
|
|
188
|
+
/**
|
|
189
|
+
* * Rounds a number to the nearest specified interval.
|
|
190
|
+
* @param value - The number to round.
|
|
191
|
+
* @param interval - The interval to round to. Defaults to `5`.
|
|
192
|
+
* @returns The number rounded to the nearest interval.
|
|
193
|
+
* @example roundToNearest(27, 5) → 25
|
|
194
|
+
*/
|
|
195
|
+
const roundToNearest = (value, interval = 5) => {
|
|
196
|
+
return Math.round(Number(value) / interval) * interval;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* * Returns the ordinal suffix for a given number (e.g., 1 -> 'st', 2 -> 'nd', 3 -> 'rd', 4 -> 'th' etc.).
|
|
200
|
+
* @description The function handles special cases for 11, 12, and 13, which all use 'th' despite the last digit.
|
|
201
|
+
* If the `withNumber` parameter is `true`, the function returns the number along with its ordinal suffix (e.g., "1st").
|
|
202
|
+
* Otherwise, it returns only the ordinal suffix (e.g., "st").
|
|
203
|
+
*
|
|
204
|
+
* @param num - The number or number string to get the ordinal suffix for.
|
|
205
|
+
* @param withNumber - Whether to include the number along with its ordinal suffix (defaults to `true`).
|
|
206
|
+
* @returns The appropriate ordinal suffix, optionally with the number (e.g., '1st' or 'st`, '2nd' or 'nd' and so on.).
|
|
207
|
+
*/
|
|
208
|
+
const getOrdinal = (num, withNumber = true) => {
|
|
209
|
+
const remainder10 = Number(num) % 10;
|
|
210
|
+
const remainder100 = Number(num) % 100;
|
|
211
|
+
let suffix;
|
|
212
|
+
if (remainder10 === 1 && remainder100 !== 11) suffix = "st";
|
|
213
|
+
else if (remainder10 === 2 && remainder100 !== 12) suffix = "nd";
|
|
214
|
+
else if (remainder10 === 3 && remainder100 !== 13) suffix = "rd";
|
|
215
|
+
else suffix = "th";
|
|
216
|
+
return withNumber ? String(num).concat(suffix) : suffix;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* * Normalize a number or numeric string to a number.
|
|
220
|
+
* @description
|
|
221
|
+
* This function checks if the input is a number or a numeric string and converts it to a number.
|
|
222
|
+
* If the input is not a valid number or numeric string, it returns `undefined`.
|
|
223
|
+
* @param num - The number to normalize.
|
|
224
|
+
* @returns The normalized number or `undefined` if the input is not a valid number or numeric string.
|
|
225
|
+
*/
|
|
226
|
+
function normalizeNumber(num) {
|
|
227
|
+
return isNumber(num) ? num : isNumericString(num) ? Number(num) : void 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/basics-DQe9mP_M.mjs
|
|
232
|
+
/**
|
|
233
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
234
|
+
*
|
|
235
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
236
|
+
* you may not use this file except in compliance with the License.
|
|
237
|
+
* You may obtain a copy of the License at
|
|
238
|
+
*
|
|
239
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
240
|
+
*
|
|
241
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
242
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
243
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
244
|
+
* See the License for the specific language governing permissions and
|
|
245
|
+
* limitations under the License.
|
|
246
|
+
*/
|
|
247
|
+
/**
|
|
248
|
+
* * Trims all the words in a string or an array of strings.
|
|
249
|
+
*
|
|
250
|
+
* @param input String or array of strings.
|
|
251
|
+
* @returns Trimmed string or array of strings.
|
|
252
|
+
*/
|
|
253
|
+
function trimString(input) {
|
|
254
|
+
if (!input) return "";
|
|
255
|
+
if (isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
|
|
256
|
+
if (Array.isArray(input)) return input.map((str) => isNonEmptyString(str) ? str.trim().replace(/\s+/g, " ") : str);
|
|
257
|
+
throw new TypeError("Expected string or array of strings!", { cause: "Invalid Input Type" });
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/convert-C8LsoKmI.mjs
|
|
262
|
+
/**
|
|
263
|
+
* * Reverses a given string.
|
|
264
|
+
* @param input - The string to reverse.
|
|
265
|
+
* @returns The reversed string.
|
|
266
|
+
*/
|
|
267
|
+
const reverseString = (input) => {
|
|
268
|
+
return trimString(input)?.split("")?.reverse()?.join("");
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* * Returns a grammatically correct unit string, optionally prefixed with the number.
|
|
272
|
+
*
|
|
273
|
+
* @remarks For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/utilities/string/pluralizer pluralizer} or {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/Pluralizer Pluralizer Class} instead.
|
|
274
|
+
*
|
|
275
|
+
* @param count The numeric value to determine singular or plural.
|
|
276
|
+
* @param unit The unit name (e.g., "day", "hour").
|
|
277
|
+
* @param withNumber Whether to prefix the count before the unit. Defaults to `true`.
|
|
278
|
+
* @returns Formatted unit string like `"1 day"`, `"2 months"`, or `"hour"`.
|
|
279
|
+
*/
|
|
280
|
+
function formatUnitWithPlural(count, unit, withNumber = true) {
|
|
281
|
+
const pluralized = Math.abs(count) === 1 ? unit : `${unit}s`;
|
|
282
|
+
return withNumber ? `${count} ${pluralized}` : pluralized;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
//#endregion
|
|
286
|
+
Object.defineProperty(exports, 'BN_DIGITS', {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
get: function () {
|
|
289
|
+
return BN_DIGITS;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(exports, 'formatUnitWithPlural', {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function () {
|
|
295
|
+
return formatUnitWithPlural;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
Object.defineProperty(exports, 'getOrdinal', {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
get: function () {
|
|
301
|
+
return getOrdinal;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
Object.defineProperty(exports, 'isBoolean', {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
get: function () {
|
|
307
|
+
return isBoolean;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
Object.defineProperty(exports, 'isFunction', {
|
|
311
|
+
enumerable: true,
|
|
312
|
+
get: function () {
|
|
313
|
+
return isFunction;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
Object.defineProperty(exports, 'isNonEmptyString', {
|
|
317
|
+
enumerable: true,
|
|
318
|
+
get: function () {
|
|
319
|
+
return isNonEmptyString;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
Object.defineProperty(exports, 'isNotEmptyObject', {
|
|
323
|
+
enumerable: true,
|
|
324
|
+
get: function () {
|
|
325
|
+
return isNotEmptyObject;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
Object.defineProperty(exports, 'isNumber', {
|
|
329
|
+
enumerable: true,
|
|
330
|
+
get: function () {
|
|
331
|
+
return isNumber;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
Object.defineProperty(exports, 'isNumericString', {
|
|
335
|
+
enumerable: true,
|
|
336
|
+
get: function () {
|
|
337
|
+
return isNumericString;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
Object.defineProperty(exports, 'isObject', {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
get: function () {
|
|
343
|
+
return isObject;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
Object.defineProperty(exports, 'isObjectWithKeys', {
|
|
347
|
+
enumerable: true,
|
|
348
|
+
get: function () {
|
|
349
|
+
return isObjectWithKeys;
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
Object.defineProperty(exports, 'isString', {
|
|
353
|
+
enumerable: true,
|
|
354
|
+
get: function () {
|
|
355
|
+
return isString;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
Object.defineProperty(exports, 'isUndefined', {
|
|
359
|
+
enumerable: true,
|
|
360
|
+
get: function () {
|
|
361
|
+
return isUndefined;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
Object.defineProperty(exports, 'isValidArray', {
|
|
365
|
+
enumerable: true,
|
|
366
|
+
get: function () {
|
|
367
|
+
return isValidArray;
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
Object.defineProperty(exports, 'normalizeNumber', {
|
|
371
|
+
enumerable: true,
|
|
372
|
+
get: function () {
|
|
373
|
+
return normalizeNumber;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
Object.defineProperty(exports, 'reverseString', {
|
|
377
|
+
enumerable: true,
|
|
378
|
+
get: function () {
|
|
379
|
+
return reverseString;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
Object.defineProperty(exports, 'roundToNearest', {
|
|
383
|
+
enumerable: true,
|
|
384
|
+
get: function () {
|
|
385
|
+
return roundToNearest;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { c as isNumericString, f as BN_DIGITS, h as isNumber, m as isNonEmptyString } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
18
|
+
|
|
19
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/index.mjs
|
|
20
|
+
/**
|
|
21
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License.
|
|
25
|
+
* You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* * Converts Latin (Arabic system) digits to Bangla digits (Arabic system).
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* - Accepts numbers or numeric strings including non-digit characters.
|
|
40
|
+
* - When `preserveNonDigit` is `true`, non-digit characters are preserved in the output.
|
|
41
|
+
* - When `preserveNonDigit` is `false`, non-numeric strings are stripped.
|
|
42
|
+
* - Returns empty string for invalid input.
|
|
43
|
+
*
|
|
44
|
+
* @param digit - A number or string containing Latin (Arabic system) digits.
|
|
45
|
+
* @param preserveNonDigit - Whether to preserve non-digit characters in the output. Default is `true`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* digitToBangla(123); // "১২৩"
|
|
49
|
+
* digitToBangla('456'); // "৪৫৬"
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* digitToBangla('12ab', false); // "১২"
|
|
53
|
+
* digitToBangla('12ab'); // "১২ab"
|
|
54
|
+
*/
|
|
55
|
+
function digitToBangla(digit, preserveNonDigit = true) {
|
|
56
|
+
const banglaDigits = Object.keys(BN_DIGITS);
|
|
57
|
+
const _matchAndConvert = (value) => {
|
|
58
|
+
return value.replace(/\d/g, (dig) => banglaDigits[Number(dig)]);
|
|
59
|
+
};
|
|
60
|
+
if (isNumber(digit)) return _matchAndConvert(String(digit));
|
|
61
|
+
if (isNonEmptyString(digit)) {
|
|
62
|
+
const bnDigStr = _matchAndConvert(digit);
|
|
63
|
+
if (preserveNonDigit || isNumericString(digit)) return bnDigStr;
|
|
64
|
+
return bnDigStr.split("").filter((dig) => banglaDigits.includes(dig)).join("");
|
|
65
|
+
}
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { digitToBangla as t };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
18
|
+
|
|
19
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/index.mjs
|
|
20
|
+
/**
|
|
21
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License.
|
|
25
|
+
* You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* * Converts Latin (Arabic system) digits to Bangla digits (Arabic system).
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* - Accepts numbers or numeric strings including non-digit characters.
|
|
40
|
+
* - When `preserveNonDigit` is `true`, non-digit characters are preserved in the output.
|
|
41
|
+
* - When `preserveNonDigit` is `false`, non-numeric strings are stripped.
|
|
42
|
+
* - Returns empty string for invalid input.
|
|
43
|
+
*
|
|
44
|
+
* @param digit - A number or string containing Latin (Arabic system) digits.
|
|
45
|
+
* @param preserveNonDigit - Whether to preserve non-digit characters in the output. Default is `true`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* digitToBangla(123); // "১২৩"
|
|
49
|
+
* digitToBangla('456'); // "৪৫৬"
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* digitToBangla('12ab', false); // "১২"
|
|
53
|
+
* digitToBangla('12ab'); // "১২ab"
|
|
54
|
+
*/
|
|
55
|
+
function digitToBangla(digit, preserveNonDigit = true) {
|
|
56
|
+
const banglaDigits = Object.keys(require_convert_C8LsoKmI.BN_DIGITS);
|
|
57
|
+
const _matchAndConvert = (value) => {
|
|
58
|
+
return value.replace(/\d/g, (dig) => banglaDigits[Number(dig)]);
|
|
59
|
+
};
|
|
60
|
+
if (require_convert_C8LsoKmI.isNumber(digit)) return _matchAndConvert(String(digit));
|
|
61
|
+
if (require_convert_C8LsoKmI.isNonEmptyString(digit)) {
|
|
62
|
+
const bnDigStr = _matchAndConvert(digit);
|
|
63
|
+
if (preserveNonDigit || require_convert_C8LsoKmI.isNumericString(digit)) return bnDigStr;
|
|
64
|
+
return bnDigStr.split("").filter((dig) => banglaDigits.includes(dig)).join("");
|
|
65
|
+
}
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
Object.defineProperty(exports, 'digitToBangla', {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return digitToBangla;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { isValidTime } from "./guards.mjs";
|
|
18
|
-
import { n as extractHourMinute, p as getTotalMinutes } from "./
|
|
18
|
+
import { n as extractHourMinute, p as getTotalMinutes } from "./utils-DBy7S7hH.mjs";
|
|
19
19
|
|
|
20
|
-
//#region src/
|
|
20
|
+
//#region src/utilities/greet.ts
|
|
21
21
|
/**
|
|
22
22
|
* * Returns a greeting message based on the provided time or current time.
|
|
23
23
|
*
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_guards = require('./guards.cjs');
|
|
18
|
-
const
|
|
18
|
+
const require_utils = require('./utils-S_aw0TeC.cjs');
|
|
19
19
|
|
|
20
|
-
//#region src/
|
|
20
|
+
//#region src/utilities/greet.ts
|
|
21
21
|
/**
|
|
22
22
|
* * Returns a greeting message based on the provided time or current time.
|
|
23
23
|
*
|
|
@@ -28,18 +28,18 @@ function getGreeting(configs) {
|
|
|
28
28
|
const { morningEnds = "11:59", noonEnds = "12:59", afternoonEnds = "17:59", eveningEnds = "23:59", midnightEnds = "02:59", currentTime, appendToMsg = "", prependToMsg = "", morningMessage = "Good Morning!", noonMessage = "Good Noon!", afternoonMessage = "Good Afternoon!", eveningMessage = "Good Evening!", midnightMessage = "Hello, Night Owl!", defaultMessage = "Greetings!" } = configs || {};
|
|
29
29
|
let hour;
|
|
30
30
|
let minute;
|
|
31
|
-
if (currentTime && require_guards.isValidTime(currentTime)) [hour, minute] =
|
|
31
|
+
if (currentTime && require_guards.isValidTime(currentTime)) [hour, minute] = require_utils.extractHourMinute(currentTime);
|
|
32
32
|
else {
|
|
33
33
|
const now = /* @__PURE__ */ new Date();
|
|
34
34
|
hour = now.getHours();
|
|
35
35
|
minute = now.getMinutes();
|
|
36
36
|
}
|
|
37
37
|
const currentTotalMinutes = hour * 60 + minute;
|
|
38
|
-
const morningEndMinutes =
|
|
39
|
-
const noonEndMinutes =
|
|
40
|
-
const afternoonEndMinutes =
|
|
41
|
-
const eveningEndMinutes =
|
|
42
|
-
if (currentTotalMinutes <=
|
|
38
|
+
const morningEndMinutes = require_utils.getTotalMinutes(morningEnds);
|
|
39
|
+
const noonEndMinutes = require_utils.getTotalMinutes(noonEnds);
|
|
40
|
+
const afternoonEndMinutes = require_utils.getTotalMinutes(afternoonEnds);
|
|
41
|
+
const eveningEndMinutes = require_utils.getTotalMinutes(eveningEnds);
|
|
42
|
+
if (currentTotalMinutes <= require_utils.getTotalMinutes(midnightEnds)) return prependToMsg.concat(midnightMessage.concat(appendToMsg));
|
|
43
43
|
else if (currentTotalMinutes <= morningEndMinutes) return prependToMsg.concat(morningMessage.concat(appendToMsg));
|
|
44
44
|
else if (currentTotalMinutes <= noonEndMinutes) return prependToMsg.concat(noonMessage.concat(appendToMsg));
|
|
45
45
|
else if (currentTotalMinutes <= afternoonEndMinutes) return prependToMsg.concat(afternoonMessage.concat(appendToMsg));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { n as reverseString } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
18
|
+
|
|
19
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/guards.mjs
|
|
20
|
+
/**
|
|
21
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License.
|
|
25
|
+
* You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* * Checks if a string is a palindrome.
|
|
37
|
+
* @param input - The string to check.
|
|
38
|
+
* @returns True if the string is a palindrome, otherwise false.
|
|
39
|
+
*/
|
|
40
|
+
const isPalindrome = (input) => {
|
|
41
|
+
const normalized = input.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
42
|
+
return normalized === reverseString(normalized);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { isPalindrome as t };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
18
|
+
|
|
19
|
+
//#region node_modules/.pnpm/toolbox-x@1.0.1-rc.6/node_modules/toolbox-x/dist/guards.mjs
|
|
20
|
+
/**
|
|
21
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License.
|
|
25
|
+
* You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* * Checks if a string is a palindrome.
|
|
37
|
+
* @param input - The string to check.
|
|
38
|
+
* @returns True if the string is a palindrome, otherwise false.
|
|
39
|
+
*/
|
|
40
|
+
const isPalindrome = (input) => {
|
|
41
|
+
const normalized = input.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
42
|
+
return normalized === require_convert_C8LsoKmI.reverseString(normalized);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
Object.defineProperty(exports, 'isPalindrome', {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return isPalindrome;
|
|
50
|
+
}
|
|
51
|
+
});
|