nhb-toolbox 4.23.20 → 4.23.23

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/CHANGELOG.md ADDED
@@ -0,0 +1,547 @@
1
+ # Changelog
2
+
3
+ <!-- markdownlint-disable-file MD024 -->
4
+
5
+ All notable changes to the package will be documented here.
6
+
7
+ ---
8
+
9
+ ## [4.23.23] - 2025-10-26
10
+
11
+ - **Fixed** *pluralization issue* with `'foot' --> 'feet'` for *format methods* in *converter classes*.
12
+ - **Renamed** the export of `GENERAL_UNITS` (used in `Unit` class) and `CATEGORIZED_UNITS` (used in `Converter` classes) from `'nhb-toolbox/constants'`.
13
+
14
+ ## [4.23.21] - 2025-10-25
15
+
16
+ - **Fixed** *return type* (now maintains *proper order* in the *tuple*) for `supportedUnits()` *converter method*.
17
+
18
+ ## [4.23.20] - 2025-10-25
19
+
20
+ - **Fixed** *return type* for `supportedUnits()` *converter method*.
21
+ - **Added** *new package subpath* for `Color` class: `'nhb-toolbox/color'`.
22
+
23
+ ## [4.23.11] - 2025-10-24
24
+
25
+ - **Added** new base method `supportedUnits()` to get an *array/tuple of supported unit names*.
26
+ - **Fixed** *precision issues* in several *conversion factors* across *converter classes*.
27
+ - **Optimized** the `formatTo()` method for improved *performance*.
28
+
29
+ ## [4.23.10] - 2025-10-24
30
+
31
+ - **Added** `metre` variants of units where needed in *converter classes*.
32
+ - **Updated & Optimized** subpath exports for *converter classes* and *functions*.
33
+
34
+ ## [4.23.1] - 2025-10-24
35
+
36
+ - **Exported** *all the converter classes* from the `'nhb-toolbox/converter'` sub-path too.
37
+
38
+ ## [4.23.0] - 2025-10-24
39
+
40
+ - **Added** new *unit converter classes* and their *combined function* `Converter` (aliased `converter`).
41
+ - **Introduced** new *utility types:* `Replace` `ReplaceFirst` and `$Record`.
42
+ - **Exported** `pluralizer`, `verbalizer`, `httpStatus` and new `Converter` utility through different *package sub-paths*.
43
+
44
+ ## [4.21.14] - 2025-10-14
45
+
46
+ - **Moved** `getTimeZoneName` method to `Chronos` *plugin system*, usable via `timeZonePlugin` and enhanced `timeZonePlugin`.
47
+
48
+ ## [4.21.10] - 2025-10-13
49
+
50
+ - **Moved** `round` method to `Chronos` *plugin system*, usable via `roundPlugin`.
51
+ - **Updated** *tsdoc* for some `Chronos` methods with *proper references.*
52
+
53
+ ## [4.21.4] - 2025-10-13
54
+
55
+ - **Added** new type `$UTCOffset` and applied in corresponding `Chronos` methods.
56
+
57
+ ## [4.21.1] - 2025-10-13
58
+
59
+ - **Updated** `TypeScript` compiler target from `ESNext` to `ES2023` for *more stable and predictable* `JavaScript` output.
60
+ - *Ensures consistent syntax across `TypeScript` versions.*
61
+
62
+ ## [4.21.0] - 2025-10-12
63
+
64
+ - **Renamed** `RomanNumeralCap` type to `RomanCapital` and allow only strict `1-3999` and `RomanNumeral` type to `LooseRomanNumeral`.
65
+ - **Removed** all *Roman numeral type helpers* and **recreated** a *strict* `RomanNumeral` with other *internal types*.
66
+
67
+ ## [4.20.92] - 2025-10-12
68
+
69
+ - **Fixed** `RomanNumeralCap` type and **added** *@remarks* section.
70
+
71
+ ## [4.20.91] - 2025-10-12
72
+
73
+ - **Updated** *tsdoc* for `fromNow()` `Chronos` method: modified *@remarks* section.
74
+
75
+ ## [4.20.90] - 2025-10-12
76
+
77
+ - **Updated** `formatUnitWithPlural` utility: now returns *singular unit* for both `0` and `1`.
78
+ - **Updated** `fromNow()` `Chronos` method: **fixed** issues when provided unit level value is `0`.
79
+
80
+ ## [4.20.89] - 2025-10-12
81
+
82
+ - **Updated** behavior of `fromNow()` `Chronos` method: *excluded* `week` level and *included* `millisecond` for consistency. **Refactored** *internal logic*.
83
+
84
+ ## [4.20.88] - 2025-10-11
85
+
86
+ - **Added** new utility `romanToInteger` and its *aliases* to convert *Roman numerals* to *Arabic numeric* representation and **updated** *input validation* for `convertToRomanNumerals`.
87
+ - **Added** new *utility type* `Repeat` to repeat literal string, it works like `String.prototype.repeat()` but on *type-level*.
88
+
89
+ ## [4.20.87] - 2025-10-08
90
+
91
+ - **Added** new *constants* and *types* related to *country information*, e.g. *full country name, code, ISO code* etc.
92
+
93
+ ## [4.20.86] - 2025-10-08
94
+
95
+ - **Added** new *number utility* `getFactors` and its alias to calculate *factors* of a given number (*integer*).
96
+
97
+ ## [4.20.84] - 2025-10-07
98
+
99
+ - **Added** new *number utility* `factorial` and its alias to calculate *factorial* of a given number (*integer*).
100
+
101
+ ## [4.20.80] - 2025-10-07
102
+
103
+ ### 🕧 Updates in Chronos
104
+
105
+ - **Added** *overload signatures* for `isWeekend`, `isWorkDay` and `isBusinessHour` methods from `businessPlugin`.
106
+ - **Fixed** issues with `isBusinessHour`: previously skipped *business start and end hours* in some cases.
107
+ - **Added** new *utility type* `RangeTuple` to create *ranged tuple*.
108
+
109
+ ## [4.20.69-70] - 2025-10-07
110
+
111
+ ### 🕧 Updates in Chronos
112
+
113
+ - **Added** *alias* for some methods available through *plugins*: `greet` for `getGreeting`, `getSeasonName` for `season`, `zodiac` for `getZodiacSign`
114
+ - **Updated** behaviors of `isWeekend`, `isWorkDay` and `isBusinessHour` methods from `businessPlugin`, now accepts *indices of weekend day as tuple*.
115
+ - **Updated** *internal states* for most of the plugins; **Renamed** some internal *types* and *exposed* some.
116
+
117
+ ## [4.20.66] - 2025-10-05
118
+
119
+ - **Updated** `isObjectWithKeys`: now returns more *structured object shape* with provided keys.
120
+
121
+ ## [4.20.64] - 2025-10-05
122
+
123
+ - **Updated** `extractObjectKeys`: now have *overload signatures*, returns a *tuple* or an *array of keys* (string literal).
124
+ - **Updated** `extractObjectKeysDeep` no longer returns a *tuple*, instead now it returns an *array of keys* (string literal).
125
+
126
+ ## [4.20.60] - 2025-10-04
127
+
128
+ - **Added** new *utility types* `ArrayToTuple<T[]>` and `Tuple<T>`.
129
+ - **Updated** the *return type* of `extractObjectKeys`, now it returns *tuple of exact top-level keys*.
130
+ - **Added** new utility `extractObjectKeysDeep` to extract *tuple* of *all nested keys*.
131
+ - **Updated** *query string parser* utilities to receive *generic return type*.
132
+ - **Added** new utility `literalQueryStringToObject` to parse *literal query string*.
133
+
134
+ ## [4.20.56] - 2025-10-02
135
+
136
+ - **Updated** `isDeepEqual` utility: Now it accepts *arguments of unknown types*.
137
+
138
+ ## [4.20.54] - 2025-10-02
139
+
140
+ - **Added** new utility `extractObjectKeys` to *extract keys of an object* with *proper typing*.
141
+ - **Updated** `isObjectWithKeys`: *now properly typed*.
142
+
143
+ ## [4.20.52] - 2025-09-26
144
+
145
+ - **Added** new `Chronos` *plugin* `greetingPlugin` for accessing `getGreeting` method in `Chronos` instances.
146
+ - **Fixed** some *docs and internal type related issues* in `convertObjectValues` utility.
147
+
148
+ ## [4.20.50] - 2025-09-25
149
+
150
+ - **Fixed** *return type* of `convertObjectValues` utility to correctly reflect the *transformed object structure* and `keys` option is now *more strict*: **only accepts keys which values are string and/or number** and **the array cannot be left empty**.
151
+ - **Updated** *options type* for `with()` *static method* of `Chronos`.
152
+
153
+ ## [4.20.48] - 2025-09-22
154
+
155
+ - **Wrapped** `ChronosMethods` type in `LooseLiteral` to allow passing *custom method names* without *type errors* when creating a custom [`Chronos Plugin`](https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/plugins#%EF%B8%8F-writing-your-own-custom-plugin).
156
+ - **Updated** *error message* in `convert` method in `Currency` class.
157
+
158
+ ## [4.20.46] - 2025-09-22
159
+
160
+ - `Chronos` class is now *exported via subpath* `'nhb-toolbox/chronos'`.
161
+
162
+ ## [4.20.44] - 2025-09-20
163
+
164
+ - **Updated** type related issues in `Finder` class. Now it accepts *array of objects only*.
165
+
166
+ ## [4.20.40] - 2025-09-18
167
+
168
+ - **Added** new **utility types**: `DeepPartialAll`, `Join`,`Split` along with `ValidArray`, `List` and *more*.
169
+
170
+ ## [4.20.32] - 2025-09-17
171
+
172
+ - **Renamed** `isPastParticiple()` method to `isParticiple()` in `Verbalizer/verbalizer`.
173
+ - **Optimized** *internal logic* for `toPast()` and `toParticiple()` methods in `Verbalizer/verbalizer`.
174
+ - **Updated** all the *rules* for `Verbalizer/verbalizer`.
175
+
176
+ ## [4.20.30] - 2025-09-17
177
+
178
+ - **Reduced** *unpacked size* by **removing** *tsdoc comments* from js (both `cjs` and `esm`) outputs.
179
+ - **Updated** tsdoc for `Verbalizer/verbalizer`: **added** reference to documentation site.
180
+
181
+ ## [4.20.27] - 2025-09-16
182
+
183
+ - **Fixed** *issues*: (**failed to convert already past/participle regular verbs**) with `toPast()` and `toParticiple()` methods in `Verbalizer/verbalizer`.
184
+
185
+ ## [4.20.26] - 2025-09-16
186
+
187
+ - **Optimized** *internal logic* in both `Pluralizer` and `Verbalizer`.
188
+
189
+ ## [4.20.24] - 2025-09-15
190
+
191
+ - **Added** new class `Verbalizer` and its shared instance `verbalizer` for verb form(s) manipulation.
192
+ - **Updated** `Pluralizer/pluralizer`'s *internal mechanism* to *trim* input(s) and output(s).
193
+
194
+ ## [4.20.20] - 2025-09-04
195
+
196
+ ### 🎨 Updates for Stylog/LogStyler
197
+
198
+ - **Reorganized** full `stylog` module.
199
+ - **Renamed** `string()` method to `toANSI()` and `applyStyles()` to `toCSS()`.
200
+ - **Added** new `ansi16()` method to apply `ANSI-16` color codes.
201
+ - **Added** new `hsl()` and `bgHSL()` methods to colorize using custom `hsl` color values.
202
+ - **Added** new `rgb()` and `bgRGB()` methods to colorize using custom `rgb` color values.
203
+ - **Added** new `hex()` and `bgHex()` methods to colorize using custom `hex` color values.
204
+
205
+ ## [4.20.17] - 2025-09-02
206
+
207
+ - **Added** *color support detector* for shell/console for `Stylog`/`LogStyler`.
208
+
209
+ ## [4.20.16] - 2025-09-01
210
+
211
+ - **Added** new method `string()` in `LogStyler` (also in `Stylog`) and **made** `applyStyles()` method *public*.
212
+
213
+ ## [4.20.11] - 2025-09-01
214
+
215
+ - **Added** new *Symbol* methods in `Chronos`: `Symbol.isConcatSpreadable` and `Symbol.match`.
216
+ - **Fixed** string coercion issues with `toPrimitive` *Symbol* method in `Chronos`.
217
+ - **Redesigned** `chronos` (`Chronos` wrapper) with *Proxy* and **updated** *TSDoc* for `chronos`.
218
+
219
+ ## [4.20.10] - 2025-09-01
220
+
221
+ - **Added** new *utility types*: `RequireAtLeast`, `RequireExactly`, `RequireBetween`.
222
+ - **Added** new *static* `Chronos` method `Chronos.with(options)` to create `Chronos` instance from specified *time component(s)*.
223
+
224
+ ## [4.20.1] - 2025-08-31
225
+
226
+ - **Exported** *helper function and guards* used for `Stylog` and `LogStyler`: `hexToAnsi`, `isCSSColor`, `isBGColor`, `isTextStyle`.
227
+
228
+ ## [4.20.0] - 2025-08-31
229
+
230
+ - **Added** new class `LogStyler` and its chainable `Stylog` utility to log styled input in the console.
231
+
232
+ ## [4.14.16] - 2025-08-30
233
+
234
+ - **Updated** *types* related to *object flattening utilities*: `FlattenDotKey`, `DotValue`, `FlattenDotValue`, `FlattenLeafKey`, `LeafValue` and `FlattenLeafValue`.
235
+ - **Made** all the (output) properties of `FlattenDotValue` and `FlattenLeafValue` *optional* to avoid issues.
236
+
237
+ ## [4.14.14] - 2025-08-27
238
+
239
+ - **Updated** `DeepPartial` type to preserve optional properties of advanced types like `File`, `FileList`, `Chronos` etc.
240
+
241
+ ## [4.14.13] - 2025-08-24
242
+
243
+ - **Updated** *return type* for `getColorForInitial` utility and **improved** *internal logic* and *error type* for color generator utilities.
244
+
245
+ ## [4.14.12] - 2025-08-23
246
+
247
+ - **Updated** *error type* for `trimString` utility.
248
+
249
+ ## [4.14.10] - 2025-08-17
250
+
251
+ - **Added** new utility `wordsToNumber` utility with alias: `convertWordsToNumber`, `convertWordToNumber` and `wordToNumber`
252
+
253
+ ## [4.14.9] - 2025-08-16
254
+
255
+ - **Fixed** minor *internal issues* and **updated** JSDoc for `Pluralizer`.
256
+
257
+ ## [4.14.4-8] - 2025-08-13 - 2025-08-14
258
+
259
+ - **Updated** internal logic of `convertStringCase` utility, added new `options` parameter.
260
+ - **Fixed** multiple *internal issues* and JSDoc; Optimized internal logic.
261
+
262
+ ## [4.14.1-3] - 2025-08-11 - 2025-08-12
263
+
264
+ - **Updated** JSDoc, dev dependencies and **fixed** minor issues.
265
+
266
+ ## [4.14.0] - 2025-08-11
267
+
268
+ - **Added** new class `HttpStatus` for retrieving and managing HTTP status codes.
269
+
270
+ ## [4.13.11] - 2025-08-06
271
+
272
+ - **Fixed** an issue with `getZodiacSign` method in `Chronos` that could not return correct *Vedic* sign.
273
+
274
+ ## [4.13.10] - 2025-08-02
275
+
276
+ - **Updated** docs for `isPlural` and `isSingular` methods in `Pluralizer`.
277
+ - **Updated** `getTimeZoneName()` and `getTimeZoneNameShort()` methods in `Chronos` to accept an optional UTC offset.
278
+ - **Changed** return type of `getTimeZoneName()` to `string | UTCOffset` using `LooseLiteral<UTCOffset>`.
279
+
280
+ ## [4.13.9] - 2025-07-31
281
+
282
+ - **Added** new `Chronos` method `getTimeZoneName()` to get full time-zone name.
283
+ - **Added** new `Chronos` `timeZonePlugin` method `getTimeZoneNameShort()` to get abbreviated time-zone name.
284
+
285
+ ## [4.13.7] - 2025-07-23
286
+
287
+ - **Updated** `isPlural` and `isSingular` methods in `Pluralizer` class to handle more cases.
288
+ - **Ran full test** on `pluralizer` and fixed some known issues.
289
+
290
+ ## [4.13.3-6] - 2025-07-22
291
+
292
+ - **Reordered** rules for `pluralizer` and fixed other issues.
293
+
294
+ ## [4.13.3] - 2025-07-22
295
+
296
+ - **Updated** *pluralization/uncountable rules*, *case restoration method* and fixed other bugs in `pluralizer`.
297
+ - **Updated** docs for `pluralizer`, `Pluralizer` and `formatUnitWithPlural`.
298
+
299
+ ## [4.13.1] - 2025-07-22
300
+
301
+ - **Updated** docs in [README](README.md) for `pluralizer`.
302
+
303
+ ## [4.13.0] - 2025-07-22
304
+
305
+ - **Added** new `Pluralizer` class and utility `pluralizer` (shared instance of `Pluralizer` class) with multiple methods.
306
+ - **Refactored** codes in number utilities, introduced new `normalizeNumber` utility.
307
+
308
+ ## [4.12.80-81] - 2025-07-19
309
+
310
+ - **Updated** `convertArrayToString` to accept array of any primitive values.
311
+ - **Fully integrated** with [nhb-scripts](https://www.npmjs.com/package/nhb-scripts/).
312
+
313
+ ## [4.12.70] - 2025-07-08
314
+
315
+ - **Updated** numeric string related issues, specifically in `isNumber` & `isNumericString` and other helper functions.
316
+
317
+ ## [4.12.68-69] - 2025-07-05
318
+
319
+ - **Updated Docs:** Added links to other npm packages.
320
+
321
+ ## [4.12.67] - 2025-07-03
322
+
323
+ - **Fixed** some import alias typo.
324
+
325
+ ## [4.12.66] - 2025-07-02
326
+
327
+ - **Updated** `convertArrayToString` function, now accepts array of objects and have 2 overload signatures with options.
328
+ - **Updated** `RenameKeys` utility type by fixing some minor issues.
329
+
330
+ ## [4.12.64] - 2025-07-02
331
+
332
+ - **Added** more utility types.
333
+ - **Updated** JSDoc for some `Chronos` methods.
334
+
335
+ ## [4.12.61] - 2025-06-28
336
+
337
+ - **Added** new utility type `Expand<T>` to resolve complex helper-wrapped types into readable structures, similar to `Prettify<T>` but only for special types to use with.
338
+ - **Improved** type display for special cases where types were previously wrapped in multiple utility layers (e.g., `MergeAll`, `FlattenValue` etc.).
339
+
340
+ ## [4.12.60] - 2025-06-27
341
+
342
+ - **Added** new array utilities:
343
+ - `sumByField`
344
+ - `averageByField`
345
+ - `sumFieldDifference`
346
+ - `groupAndSumByField`
347
+ - `groupAndAverageByField`
348
+
349
+ - **Updated** `splitArrayByProperty` utility to allow nested field as dot-notation.
350
+
351
+ ## [4.12.50] - 2025-06-27
352
+
353
+ - **Updated** return type definition and **enhanced** internal logic for `mergeObjects`, `mergeAndFlattenObjects`, `flattenObjectKeyValue`, `flattenObjectDotNotation`.
354
+ - **Created** new utility types for the mentioned utilities.
355
+
356
+ ## [4.12.48] - 2025-06-24
357
+
358
+ - **Fixed** typo for utility name `splitArrayByProperty`.
359
+ - **Added** new utilities `getInstanceGetterNames` and `getStaticGetterNames`;
360
+ - **Updated** `getClassDetails` and its return type.
361
+
362
+ ## [4.12.46] - 2025-06-24
363
+
364
+ - **Added** new utilities ~~spitArrayByProperty~~ `splitArrayByProperty` and `deleteFields`.
365
+
366
+ ## [4.12.44] - 2025-06-23
367
+
368
+ - **Updated** `getDatesInRange()` method in `Chronos`: fixed an option conflict.
369
+
370
+ ## [4.12.43] - 2025-06-22
371
+
372
+ - **Updated** `getDatesInRange()` method in `Chronos`, now accepts both `day-names` and `day-index` array for `skipDays` and `onlyDays`.
373
+ - **Updated** JSDoc for some functions and methods.
374
+
375
+ ## [4.12.42] - 2025-06-21
376
+
377
+ - **Updated** JSDoc for some functions and methods.
378
+ - **Updated and Optimized** `getDatesInRange()` method in `Chronos`. Added new option `onlyDays` to get dates for only the provided days.
379
+ - **Allowed** `formatStrict()` method in `Chronos` to accept other string values [made less strict].
380
+
381
+ ## [4.12.41] - 2025-06-17
382
+
383
+ - **Updated** `getDatesInRange()` and `getDatesForDay()` `Chronos` methods' options to change the date rounding behaviour.
384
+
385
+ ## [4.12.40] - 2025-06-17
386
+
387
+ - **Added** new utility: `convertMinutesToTime` to convert minutes into clock-time (`H:mm`) format.
388
+ - **Exposed** important `constants` to consumers via `'nhb-toolbox/constants'` import path.
389
+
390
+ ### 🕧 Updates for Chronos
391
+
392
+ - **Added** new instance method `getDatesInRange()` to get dates in the range as ISO date string.
393
+ - **Fixed** a bug by rounding the date to the start hour of the day and **updated** internal logic in static `getDatesForDay()` method.
394
+
395
+ ## [4.12.36] - 2025-06-13
396
+
397
+ - **Added** new `convertSync()` method in `Currency` class to convert currency without network request.
398
+
399
+ ## [4.12.34-35] - 2025-06-12
400
+
401
+ - **Updated** `format()` and `convert()` methods in `Currency` class:
402
+ - `format()` method now accepts `CurrencyCode` as optional second parameter
403
+ - `convert()` method now returns a new `Currency` instance.
404
+
405
+ ## [4.12.33] - 2025-06-11
406
+
407
+ - **Trim** input string for `numberToWordsOrdinal` utility.
408
+ - **Preserve** `File`, `FileList` and other file related object(s) when processing nested object(s) using `sanitizeData`.
409
+
410
+ ## [4.12.32] - 2025-06-11
411
+
412
+ - **Fixed** a bug in `sanitizeData` and `createFormData` where key selections did not allow to choose keys with null/undefined value(s).
413
+ - **Fixed** a bug in `createFormData` where values of nested object(s) incorrectly converted to lowercase. Process `date-like object(s)` more efficiently in both utilities.
414
+
415
+ ## [4.12.31] - 2025-06-10
416
+
417
+ - **Added** new utility to convert number or numeric string to ordinal word.
418
+ - **Updated** JSDoc for some types.
419
+ - **Upgraded** TypeScript version to `5.8.3` and other dev-dependencies.
420
+
421
+ ## [4.12.28-30] - 2025-06-06
422
+
423
+ - **Resolved** a compile-time `not-assignable` error that occurred when optional properties were present in parameters of `sanitizeData`, `createFormData`, and other utility functions.
424
+ - **Added** additional utility types and integrated them into various parts of the package to improve type safety and maintainability.
425
+
426
+ ## [4.12.27] - 2025-06-02
427
+
428
+ - **Updated** [README](README.md).
429
+ - **Added** new utility types, can be imported from `'nhb-toolbox/utils/types'`.
430
+
431
+ ## [4.12.25-26] - 2025-06-02
432
+
433
+ - **Updated** JSDoc for some `Chronos` methods and exposed `INTERNALS` Symbol
434
+
435
+ ## [4.12.24] - 2025-06-01
436
+
437
+ ### 🕧 Updates for Chronos
438
+
439
+ - **Reduced** bloat by moving *rarely used* `Chronos` methods to plugin system.
440
+ - **Changed** plugin import paths as `import { somePlugin } from nhb-toolbox/plugins/somePlugin` format so the users can assume the path easily.
441
+ - **Updated** parameter type for `isBusinessHour` method: instead of multiple parameters can accept one options object now.
442
+
443
+ ## [4.12.23] - 2025-06-01
444
+
445
+ ### 🕧 Updates for Chronos
446
+
447
+ - All *plugin* imports now use statement like `import { somePlugin } from 'nhb-toolbox/plugins/plugin-path';`
448
+ - **Updated** `getZodiacSign` method: includes 2 presets `western` and `vedic` with aliases `tropical` and `sidereal`.
449
+ - **Fixed** issues in `getZodiacSign` method which previously could not parse some date/month range.
450
+
451
+ ## [4.12.21-beta.2] - 2025-05-31
452
+
453
+ - **Updated** `types.mjs` script for updating the exports fields for plugins in `package.json`.
454
+
455
+ ## [4.12.21-beta.1] - 2025-05-31
456
+
457
+ - **Updated** `getZodiacSign` method: includes 2 presets `western` and `vedic`.
458
+ - **Fixed** issues in `getZodiacSign` method.
459
+ - Experimenting with exporting each Chronos plugin as separate module from the respective locations.
460
+
461
+ ## [4.12.20] - 2025-05-31
462
+
463
+ ### 🕧 Released Plugin System for Chronos
464
+
465
+ - Plugin injection system for Chronos is now fully functional.
466
+
467
+ ## [4.12.13-beta.1] - 2025-05-31
468
+
469
+ - **Created** more plugins for resource heavy methods of `Chronos`.
470
+
471
+ ## [4.12.13-alpha.2] - 2025-05-30
472
+
473
+ - **Solved** experimental plugin export/import issues.
474
+
475
+ ## [4.12.13-alpha.1] - 2025-05-30
476
+
477
+ ### 🕧 Experimenting with Plugin System for Chronos
478
+
479
+ - **Introduced** plugin injection in `Chronos` class. Started with `season` method. Will make convert more methods if this is successful after publishing.
480
+
481
+ ## [4.12.12] - 2025-05-30
482
+
483
+ ### 🕧 Updates in Chronos
484
+
485
+ - **Added** new method `season` to get the name of the season for current Chronos instance. It has configurable options.
486
+ - All `Chronos` methods that use `#format` method internally now accepts escape tokens and new token `ZZ` is introduced to include timezone offset (or Z for UTC time) in the formatted date string.
487
+ - **Updated** some type names such as `Hours` ➡️ `ClockHour`, `Minutes` ➡️ `ClockMinute`, `Time` ➡️ `ClockTIme` etc. But the core definitions remain the same.
488
+
489
+ ## [4.12.10] - 2025-05-30
490
+
491
+ ### 🕧 New Chronos Methods
492
+
493
+ - **Added** 2 new instance methods in `Chronos`, `day` and `monthName` to get day and month names respectively.
494
+
495
+ ### ℹ️ [README](README.md)
496
+
497
+ - **Added** `Signature Utilities` section in `README.md`
498
+
499
+ ## [4.12.8] - 2025-05-29
500
+
501
+ ### Types
502
+
503
+ - **Added** new types `Enumerate` and `NumberRange` to generate number literals like `0 | 1 | 2 | ... | 998`.
504
+ - **Implemented** both types in few cases where a return type is number and limited to a range, especially in color and number related functions and `Color` & `Chronos` classes.
505
+
506
+ ### Method Changed in Chronos
507
+
508
+ - `isoWeekday` is now `isoWeekDay`
509
+ - Some method logic changed internally
510
+
511
+ ---
512
+
513
+ ## [4.12.7] - 2025-05-28
514
+
515
+ ### Docs
516
+
517
+ - ➕ Introduced `CHANGELOG.md`
518
+
519
+ ## [4.12.6] - 2025-05-28
520
+
521
+ ### Added
522
+
523
+ - ➕ `Chronos.getDatesFromDay()` — a new static method to retrieve all matching dates for a given day of the week.
524
+
525
+ ### Fixed
526
+
527
+ - 🐛 Minor internal issues and stability improvements.
528
+
529
+ ---
530
+
531
+ ## [4.12.0] - 2025-05-28
532
+
533
+ ### ⚠️ Breaking Changes
534
+
535
+ - ⚠️ **Deprecation Notice**: All versions below `4.12.0` are now marked as deprecated
536
+ - ♻️ **Build System**: Switched from `tsup` back to `tsc` for building the library to resolve compatibility and output issues.
537
+
538
+ ### Fixed
539
+
540
+ - 🛠️ Resolved ESM import issues by adding missing `.js` extensions in internal paths.
541
+ - 🧩 Improved module resolution in strict ESM-only environments.
542
+
543
+ ### Improved
544
+
545
+ - 🌲 Full **tree-shaking support** for ESM builds (CommonJS remains unaffected).
546
+ - 🌲 *From the beginning the library was tree-shakable* but now it's **properly tree-shakable** for ESM builds.
547
+ - 📦 CommonJS (`cjs`) build remains unaffected and stable.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STATUS_CODES = exports.HTTP_STATUS_CODES = exports.HTTP_STATUS = exports.HTTP_CODES = exports.COUNTRIES = exports.UNITS = exports.LOWERCASED_WORDS = exports.LOCALE_CODES = exports.FRANKFURTER_CURRENCIES = exports.CURRENCY_LOCALES = exports.CURRENCY_CODES = exports.CSS_COLORS = exports.NUMBER_COLOR_PALETTE = exports.ALPHABET_COLOR_PALETTE = exports.WESTERN_SEASONS = exports.US_ACADEMIC_SEASONS = exports.SEASON_PRESETS = exports.PHILIPPINES_SEASONS = exports.JAPAN_SEASONS = exports.INDIA_VEDIC_SEASONS = exports.INDIA_TAMIL_SEASONS = exports.INDIA_IMD_SEASONS = exports.ETHIOPIA_SEASONS = exports.BANGLADESH_SEASONS = exports.AUSTRALIA_SEASONS = exports.WESTERN_ZODIAC_SIGNS = exports.WEEK_DAYS = exports.VEDIC_ZODIAC_SIGNS = exports.TIME_ZONES = exports.TIME_ZONE_LABELS = exports.MONTHS = void 0;
3
+ exports.STATUS_CODES = exports.HTTP_STATUS_CODES = exports.HTTP_STATUS = exports.HTTP_CODES = exports.COUNTRIES = exports.CATEGORIZED_UNITS = exports.LOWERCASED_WORDS = exports.LOCALE_CODES = exports.GENERAL_UNITS = exports.FRANKFURTER_CURRENCIES = exports.CURRENCY_LOCALES = exports.CURRENCY_CODES = exports.CSS_COLORS = exports.NUMBER_COLOR_PALETTE = exports.ALPHABET_COLOR_PALETTE = exports.WESTERN_SEASONS = exports.US_ACADEMIC_SEASONS = exports.SEASON_PRESETS = exports.PHILIPPINES_SEASONS = exports.JAPAN_SEASONS = exports.INDIA_VEDIC_SEASONS = exports.INDIA_TAMIL_SEASONS = exports.INDIA_IMD_SEASONS = exports.ETHIOPIA_SEASONS = exports.BANGLADESH_SEASONS = exports.AUSTRALIA_SEASONS = exports.WESTERN_ZODIAC_SIGNS = exports.WEEK_DAYS = exports.VEDIC_ZODIAC_SIGNS = exports.TIME_ZONES = exports.TIME_ZONE_LABELS = exports.MONTHS = void 0;
4
4
  var constants_1 = require("./date/constants");
5
5
  Object.defineProperty(exports, "MONTHS", { enumerable: true, get: function () { return constants_1.MONTHS; } });
6
6
  Object.defineProperty(exports, "TIME_ZONE_LABELS", { enumerable: true, get: function () { return constants_1.TIME_ZONE_LABELS; } });
@@ -29,11 +29,12 @@ var constants_3 = require("./number/constants");
29
29
  Object.defineProperty(exports, "CURRENCY_CODES", { enumerable: true, get: function () { return constants_3.CURRENCY_CODES; } });
30
30
  Object.defineProperty(exports, "CURRENCY_LOCALES", { enumerable: true, get: function () { return constants_3.CURRENCY_LOCALES; } });
31
31
  Object.defineProperty(exports, "FRANKFURTER_CURRENCIES", { enumerable: true, get: function () { return constants_3.SUPPORTED_CURRENCIES; } });
32
+ Object.defineProperty(exports, "GENERAL_UNITS", { enumerable: true, get: function () { return constants_3.UNITS; } });
32
33
  Object.defineProperty(exports, "LOCALE_CODES", { enumerable: true, get: function () { return constants_3.LOCALE_CODES; } });
33
34
  var constants_4 = require("./string/constants");
34
35
  Object.defineProperty(exports, "LOWERCASED_WORDS", { enumerable: true, get: function () { return constants_4.LOWERCASE; } });
35
36
  var constants_5 = require("./converter/constants");
36
- Object.defineProperty(exports, "UNITS", { enumerable: true, get: function () { return constants_5.UNITS; } });
37
+ Object.defineProperty(exports, "CATEGORIZED_UNITS", { enumerable: true, get: function () { return constants_5.UNITS; } });
37
38
  var countries_1 = require("./object/countries");
38
39
  Object.defineProperty(exports, "COUNTRIES", { enumerable: true, get: function () { return countries_1.COUNTRIES; } });
39
40
  var constants_6 = require("./http-status/constants");
@@ -13,7 +13,10 @@ class $BaseConverter {
13
13
  const abs = Math.abs(value ?? this.value);
14
14
  const u = unit ?? this.unit;
15
15
  const pluralized = abs <= 1 ? u
16
- : u ? `${u}s`
16
+ : u ?
17
+ u?.endsWith('foot') ?
18
+ 'feet'
19
+ : `${u}s`
17
20
  : '';
18
21
  return `${abs} ${pluralized}`.trim();
19
22
  }
@@ -2,8 +2,8 @@ export { MONTHS, TIME_ZONE_LABELS, TIME_ZONES, VEDIC_ZODIAC_SIGNS, DAYS as WEEK_
2
2
  export { AUSTRALIA_SEASONS, BANGLADESH_SEASONS, ETHIOPIA_SEASONS, INDIA_IMD_SEASONS, INDIA_TAMIL_SEASONS, INDIA_VEDIC_SEASONS, JAPAN_SEASONS, PHILIPPINES_SEASONS, SEASON_PRESETS, US_ACADEMIC_SEASONS, DEFAULT_SEASONS as WESTERN_SEASONS, } from './date/seasons';
3
3
  export { ALPHABET_COLOR_PALETTE, NUMBER_COLOR_PALETTE } from './colors/constants';
4
4
  export { CSS_COLORS } from './colors/css-colors';
5
- export { CURRENCY_CODES, CURRENCY_LOCALES, SUPPORTED_CURRENCIES as FRANKFURTER_CURRENCIES, LOCALE_CODES, } from './number/constants';
5
+ export { CURRENCY_CODES, CURRENCY_LOCALES, SUPPORTED_CURRENCIES as FRANKFURTER_CURRENCIES, UNITS as GENERAL_UNITS, LOCALE_CODES, } from './number/constants';
6
6
  export { LOWERCASE as LOWERCASED_WORDS } from './string/constants';
7
- export { UNITS } from './converter/constants';
7
+ export { UNITS as CATEGORIZED_UNITS } from './converter/constants';
8
8
  export { COUNTRIES } from './object/countries';
9
9
  export { HTTP_STATUS_CODES as HTTP_CODES, HTTP_STATUS_CODES as HTTP_STATUS, HTTP_STATUS_CODES, HTTP_STATUS_CODES as STATUS_CODES, } from './http-status/constants';
@@ -1,6 +1,5 @@
1
1
  import type { Numeric } from '../types/index';
2
- import type { Tuple } from '../utils/types';
3
- import type { $Unit, Category, CategoryUnits, FormatToOptions, Units } from './types';
2
+ import type { $Unit, Category, FormatToOptions, Units, UnitsTuple } from './types';
4
3
  /**
5
4
  * @description Base class providing common mathematical and formatting utilities
6
5
  * for all unit converters (time, length, data, temperature, etc.).
@@ -49,7 +48,6 @@ export declare class $BaseConverter<Unit extends $Unit> {
49
48
  * @remarks
50
49
  * - This method is automatically called when the instance is used in a string context.
51
50
  * - For complex and versatile pluralization, please refer to {@link https://toolbox.nazmul-nhb.dev/docs/utilities/string/pluralizer pluralizer} or {@link https://toolbox.nazmul-nhb.dev/docs/classes/Pluralizer Pluralizer Class} instead.
52
-
53
51
  */
54
52
  toString(): string;
55
53
  /**
@@ -65,9 +63,7 @@ export declare class $BaseConverter<Unit extends $Unit> {
65
63
  * @returns JSON string of `{ value, unit }`.
66
64
  */
67
65
  toJSON(): string;
68
- /**
69
- * @instance Returns a new instance with the absolute value.
70
- */
66
+ /** @instance Returns a new instance with the absolute value. */
71
67
  abs(): this;
72
68
  /**
73
69
  * @instance Adds a numeric value (same unit assumed).
@@ -95,11 +91,11 @@ export declare class $BaseConverter<Unit extends $Unit> {
95
91
  * @returns A new instance with rounded value.
96
92
  */
97
93
  round(decimals?: number): this;
98
- /** * @instance Returns whether this value is greater than another numeric value. */
94
+ /** @instance Returns whether this value is greater than another numeric value. */
99
95
  gt(n: Numeric): boolean;
100
- /** * @instance Returns whether this value is less than another numeric value. */
96
+ /** @instance Returns whether this value is less than another numeric value. */
101
97
  lt(n: Numeric): boolean;
102
- /** * @instance Returns whether this value equals another numeric value. */
98
+ /** @instance Returns whether this value equals another numeric value. */
103
99
  eq(n: Numeric): boolean;
104
100
  /**
105
101
  * @instance Returns a human-friendly formatted string with fixed decimals (if the value is fraction).
@@ -119,5 +115,5 @@ export declare class $BaseConverter<Unit extends $Unit> {
119
115
  * @param category Category to filter units by.
120
116
  * @returns Tuple of supported units for the specified category.
121
117
  */
122
- supportedUnits<Cat extends Category>(category: Cat): Tuple<CategoryUnits<Cat>>;
118
+ supportedUnits<Cat extends Category>(category: Cat): UnitsTuple<Cat>;
123
119
  }
@@ -1,4 +1,4 @@
1
- import type { LooseLiteral } from '../utils/types';
1
+ import type { LooseLiteral, Mutable } from '../utils/types';
2
2
  import type { $Area } from './area';
3
3
  import type { $BaseConverter } from './base';
4
4
  import type { UNITS } from './constants';
@@ -9,7 +9,7 @@ import type { $Temperature } from './temp';
9
9
  import type { $Time } from './time';
10
10
  import type { $Volume } from './volume';
11
11
  /** - Type for Record of Units */
12
- type UnitsRecord = typeof UNITS;
12
+ export type UnitsRecord = typeof UNITS;
13
13
  /** * Category of units supported by the converter. */
14
14
  export type Category = keyof UnitsRecord;
15
15
  /** * Map of unit categories to their respective units. */
@@ -20,6 +20,8 @@ export type UnitMap = {
20
20
  export type $Unit = LooseLiteral<UnitMap[Category]>;
21
21
  /** * Type for array of all Units */
22
22
  export type Units = Array<UnitMap[Category]>;
23
+ /** * Tuple type for Units in a specific Category */
24
+ export type UnitsTuple<Cat extends Category> = Mutable<UnitsRecord[Cat]>;
23
25
  /** * Infer the category of a given unit type `U`. */
24
26
  export type InferCategory<U extends $Unit> = {
25
27
  [K in Category]: U extends UnitMap[K] ? K : never;
@@ -49,4 +51,3 @@ export type $TempUnit = UnitMap['temp'];
49
51
  export type $TimeUnit = UnitMap['time'];
50
52
  /** Union type for all the volume units */
51
53
  export type $VolumeUnit = UnitMap['volume'];
52
- export {};
@@ -2,8 +2,8 @@ export { MONTHS, TIME_ZONE_LABELS, TIME_ZONES, VEDIC_ZODIAC_SIGNS, DAYS as WEEK_
2
2
  export { AUSTRALIA_SEASONS, BANGLADESH_SEASONS, ETHIOPIA_SEASONS, INDIA_IMD_SEASONS, INDIA_TAMIL_SEASONS, INDIA_VEDIC_SEASONS, JAPAN_SEASONS, PHILIPPINES_SEASONS, SEASON_PRESETS, US_ACADEMIC_SEASONS, DEFAULT_SEASONS as WESTERN_SEASONS, } from './date/seasons.js';
3
3
  export { ALPHABET_COLOR_PALETTE, NUMBER_COLOR_PALETTE } from './colors/constants.js';
4
4
  export { CSS_COLORS } from './colors/css-colors.js';
5
- export { CURRENCY_CODES, CURRENCY_LOCALES, SUPPORTED_CURRENCIES as FRANKFURTER_CURRENCIES, LOCALE_CODES, } from './number/constants.js';
5
+ export { CURRENCY_CODES, CURRENCY_LOCALES, SUPPORTED_CURRENCIES as FRANKFURTER_CURRENCIES, UNITS as GENERAL_UNITS, LOCALE_CODES, } from './number/constants.js';
6
6
  export { LOWERCASE as LOWERCASED_WORDS } from './string/constants.js';
7
- export { UNITS } from './converter/constants.js';
7
+ export { UNITS as CATEGORIZED_UNITS } from './converter/constants.js';
8
8
  export { COUNTRIES } from './object/countries.js';
9
9
  export { HTTP_STATUS_CODES as HTTP_CODES, HTTP_STATUS_CODES as HTTP_STATUS, HTTP_STATUS_CODES, HTTP_STATUS_CODES as STATUS_CODES, } from './http-status/constants.js';
@@ -10,7 +10,10 @@ export class $BaseConverter {
10
10
  const abs = Math.abs(value ?? this.value);
11
11
  const u = unit ?? this.unit;
12
12
  const pluralized = abs <= 1 ? u
13
- : u ? `${u}s`
13
+ : u ?
14
+ u?.endsWith('foot') ?
15
+ 'feet'
16
+ : `${u}s`
14
17
  : '';
15
18
  return `${abs} ${pluralized}`.trim();
16
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhb-toolbox",
3
- "version": "4.23.20",
3
+ "version": "4.23.23",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -13,6 +13,7 @@
13
13
  "dist",
14
14
  "LICENSE",
15
15
  "README.md",
16
+ "CHANGELOG.md",
16
17
  "package.json"
17
18
  ],
18
19
  "repository": {