nhb-toolbox 4.28.40 → 4.28.44
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 +4 -0
- package/dist/cjs/date/Chronos.js +1 -1
- package/dist/cjs/date/chronos-fn.js +11 -13
- package/dist/cjs/date/constants.js +100 -1
- package/dist/cjs/number/constants.js +0 -8
- package/dist/dts/date/Chronos.d.ts +2 -2
- package/dist/dts/date/constants.d.ts +6 -2
- package/dist/dts/date/types.d.ts +16 -6
- package/dist/dts/hash/helpers.d.ts +1 -1
- package/dist/dts/hash/utils.d.ts +1 -4
- package/dist/dts/number/constants.d.ts +2 -6
- package/dist/esm/date/Chronos.js +1 -1
- package/dist/esm/date/chronos-fn.js +11 -13
- package/dist/esm/date/constants.js +99 -0
- package/dist/esm/number/constants.js +0 -8
- package/package.json +12 -7
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ All notable changes to the package will be documented here.
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [4.28.44] - 2025-12-19
|
|
10
|
+
|
|
11
|
+
- **Updated** `DateTimeFormatOptions` with *improved type system* and **removed** *unsupported* **locales/currencies** from *constants* and *types*.
|
|
12
|
+
|
|
9
13
|
## [4.28.40] - 2025-12-15
|
|
10
14
|
|
|
11
15
|
- **Added** *new class* `TextCodec` with only *static methods* to convert between `text`, `hex`, `binary`, and `Base64` representations using *byte-level transformations*.
|
package/dist/cjs/date/Chronos.js
CHANGED
|
@@ -216,7 +216,7 @@ class Chronos {
|
|
|
216
216
|
return this.toDate().toISOString();
|
|
217
217
|
}
|
|
218
218
|
toLocaleString(locales, options) {
|
|
219
|
-
return this.
|
|
219
|
+
return this.#date.toLocaleString(locales, options);
|
|
220
220
|
}
|
|
221
221
|
getTimeStamp() {
|
|
222
222
|
return this.toDate().getTime();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.chronos = void 0;
|
|
4
4
|
const Chronos_1 = require("./Chronos");
|
|
5
|
-
const chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
5
|
+
const $chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
6
6
|
if (typeof valueOrYear === 'number' && typeof month === 'number') {
|
|
7
7
|
return new Chronos_1.Chronos(valueOrYear, month, date ?? 1, hours ?? 0, minutes ?? 0, seconds ?? 0, ms ?? 0);
|
|
8
8
|
}
|
|
@@ -10,27 +10,25 @@ const chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
|
10
10
|
return new Chronos_1.Chronos(valueOrYear);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
function _isChronosStaticKey(prop) {
|
|
14
|
+
return (prop in Chronos_1.Chronos &&
|
|
15
|
+
prop !== 'prototype' &&
|
|
16
|
+
prop !== 'name' &&
|
|
17
|
+
prop !== 'length' &&
|
|
18
|
+
typeof Chronos_1.Chronos[prop] === 'function');
|
|
19
|
+
}
|
|
20
|
+
const chronosStatics = new Proxy($chronos, {
|
|
14
21
|
get(target, prop, receiver) {
|
|
15
22
|
if (prop in target) {
|
|
16
23
|
return Reflect.get(target, prop, receiver);
|
|
17
24
|
}
|
|
18
|
-
if (prop
|
|
19
|
-
prop !== 'prototype' &&
|
|
20
|
-
prop !== 'name' &&
|
|
21
|
-
prop !== 'length' &&
|
|
22
|
-
typeof Chronos_1.Chronos[prop] === 'function') {
|
|
25
|
+
if (_isChronosStaticKey(prop)) {
|
|
23
26
|
return Chronos_1.Chronos[prop];
|
|
24
27
|
}
|
|
25
28
|
return Reflect.get(target, prop, receiver);
|
|
26
29
|
},
|
|
27
30
|
has(target, prop) {
|
|
28
|
-
return
|
|
29
|
-
(prop in Chronos_1.Chronos &&
|
|
30
|
-
prop !== 'prototype' &&
|
|
31
|
-
prop !== 'name' &&
|
|
32
|
-
prop !== 'length' &&
|
|
33
|
-
typeof Chronos_1.Chronos[prop] === 'function'));
|
|
31
|
+
return prop in target || _isChronosStaticKey(prop);
|
|
34
32
|
},
|
|
35
33
|
});
|
|
36
34
|
exports.chronos = chronosStatics;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MS_MAP = exports.TIME_UNIT_VARIANTS = exports.ZODIAC_PRESETS = exports.VEDIC_ZODIAC_SIGNS = exports.WESTERN_ZODIAC_SIGNS = exports.DATE_PART_RANGES = exports.SORTED_TIME_FORMATS = exports.TIME_FORMATS = exports.MILLISECOND_FORMATS = exports.ZONE_FORMATS = exports.SECOND_FORMATS = exports.MINUTE_FORMATS = exports.HOUR_FORMATS = exports.DAY_FORMATS = exports.DATE_FORMATS = exports.MONTH_FORMATS = exports.YEAR_FORMATS = exports.MONTHS = exports.DAYS = exports.INTERNALS = void 0;
|
|
3
|
+
exports.LOCALE_NUMBERING_SYSTEMS = exports.LOCALE_CALENDARS = exports.MS_MAP = exports.TIME_UNIT_VARIANTS = exports.ZODIAC_PRESETS = exports.VEDIC_ZODIAC_SIGNS = exports.WESTERN_ZODIAC_SIGNS = exports.DATE_PART_RANGES = exports.SORTED_TIME_FORMATS = exports.TIME_FORMATS = exports.MILLISECOND_FORMATS = exports.ZONE_FORMATS = exports.SECOND_FORMATS = exports.MINUTE_FORMATS = exports.HOUR_FORMATS = exports.DAY_FORMATS = exports.DATE_FORMATS = exports.MONTH_FORMATS = exports.YEAR_FORMATS = exports.MONTHS = exports.DAYS = exports.INTERNALS = void 0;
|
|
4
4
|
exports.INTERNALS = Symbol('Internals');
|
|
5
5
|
exports.DAYS = /* @__PURE__ */ Object.freeze([
|
|
6
6
|
'Sunday',
|
|
@@ -151,3 +151,102 @@ exports.MS_MAP = /* @__PURE__ */ Object.freeze((() => {
|
|
|
151
151
|
milliseconds: 1,
|
|
152
152
|
};
|
|
153
153
|
})());
|
|
154
|
+
exports.LOCALE_CALENDARS = /* @__PURE__ */ Object.freeze([
|
|
155
|
+
'buddhist',
|
|
156
|
+
'chinese',
|
|
157
|
+
'coptic',
|
|
158
|
+
'dangi',
|
|
159
|
+
'ethioaa',
|
|
160
|
+
'ethiopic',
|
|
161
|
+
'gregory',
|
|
162
|
+
'hebrew',
|
|
163
|
+
'indian',
|
|
164
|
+
'islamic',
|
|
165
|
+
'islamic-civil',
|
|
166
|
+
'islamic-rgsa',
|
|
167
|
+
'islamic-tbla',
|
|
168
|
+
'islamic-umalqura',
|
|
169
|
+
'iso8601',
|
|
170
|
+
'japanese',
|
|
171
|
+
'persian',
|
|
172
|
+
'roc',
|
|
173
|
+
]);
|
|
174
|
+
exports.LOCALE_NUMBERING_SYSTEMS = /* @__PURE__ */ Object.freeze([
|
|
175
|
+
'adlm',
|
|
176
|
+
'ahom',
|
|
177
|
+
'arab',
|
|
178
|
+
'arabext',
|
|
179
|
+
'bali',
|
|
180
|
+
'beng',
|
|
181
|
+
'bhks',
|
|
182
|
+
'brah',
|
|
183
|
+
'cakm',
|
|
184
|
+
'cham',
|
|
185
|
+
'deva',
|
|
186
|
+
'diak',
|
|
187
|
+
'fullwide',
|
|
188
|
+
'gara',
|
|
189
|
+
'gong',
|
|
190
|
+
'gonm',
|
|
191
|
+
'gujr',
|
|
192
|
+
'gukh',
|
|
193
|
+
'guru',
|
|
194
|
+
'hanidec',
|
|
195
|
+
'hmng',
|
|
196
|
+
'hmnp',
|
|
197
|
+
'java',
|
|
198
|
+
'kali',
|
|
199
|
+
'kawi',
|
|
200
|
+
'khmr',
|
|
201
|
+
'knda',
|
|
202
|
+
'krai',
|
|
203
|
+
'lana',
|
|
204
|
+
'lanatham',
|
|
205
|
+
'laoo',
|
|
206
|
+
'latn',
|
|
207
|
+
'lepc',
|
|
208
|
+
'limb',
|
|
209
|
+
'mathbold',
|
|
210
|
+
'mathdbl',
|
|
211
|
+
'mathmono',
|
|
212
|
+
'mathsanb',
|
|
213
|
+
'mathsans',
|
|
214
|
+
'mlym',
|
|
215
|
+
'modi',
|
|
216
|
+
'mong',
|
|
217
|
+
'mroo',
|
|
218
|
+
'mtei',
|
|
219
|
+
'mymr',
|
|
220
|
+
'mymrepka',
|
|
221
|
+
'mymrpao',
|
|
222
|
+
'mymrshan',
|
|
223
|
+
'mymrtlng',
|
|
224
|
+
'nagm',
|
|
225
|
+
'newa',
|
|
226
|
+
'nkoo',
|
|
227
|
+
'olck',
|
|
228
|
+
'onao',
|
|
229
|
+
'orya',
|
|
230
|
+
'osma',
|
|
231
|
+
'outlined',
|
|
232
|
+
'rohg',
|
|
233
|
+
'saur',
|
|
234
|
+
'segment',
|
|
235
|
+
'shrd',
|
|
236
|
+
'sind',
|
|
237
|
+
'sinh',
|
|
238
|
+
'sora',
|
|
239
|
+
'sund',
|
|
240
|
+
'sunu',
|
|
241
|
+
'takr',
|
|
242
|
+
'talu',
|
|
243
|
+
'tamldec',
|
|
244
|
+
'telu',
|
|
245
|
+
'thai',
|
|
246
|
+
'tibt',
|
|
247
|
+
'tirh',
|
|
248
|
+
'tnsa',
|
|
249
|
+
'vaii',
|
|
250
|
+
'wara',
|
|
251
|
+
'wcho',
|
|
252
|
+
]);
|
|
@@ -243,10 +243,6 @@ exports.CURRENCY_CODES = /* @__PURE__ */ Object.freeze([
|
|
|
243
243
|
'VND',
|
|
244
244
|
'VUV',
|
|
245
245
|
'WST',
|
|
246
|
-
'XAF',
|
|
247
|
-
'XCD',
|
|
248
|
-
'XOF',
|
|
249
|
-
'XPF',
|
|
250
246
|
'YER',
|
|
251
247
|
'ZAR',
|
|
252
248
|
'ZMW',
|
|
@@ -532,10 +528,6 @@ exports.CURRENCY_LOCALES = /* @__PURE__ */ Object.freeze({
|
|
|
532
528
|
VND: 'vi-VN',
|
|
533
529
|
VUV: 'en-VU',
|
|
534
530
|
WST: 'en-WS',
|
|
535
|
-
XAF: 'fr-XAF',
|
|
536
|
-
XCD: 'en-XCD',
|
|
537
|
-
XOF: 'fr-XOF',
|
|
538
|
-
XPF: 'fr-XPF',
|
|
539
531
|
YER: 'ar-YE',
|
|
540
532
|
ZAR: 'en-ZA',
|
|
541
533
|
ZMW: 'en-ZM',
|
|
@@ -215,10 +215,10 @@ export declare class Chronos {
|
|
|
215
215
|
/** @instance Returns a date as a string value in ISO format (UTC). */
|
|
216
216
|
toISOString(): string;
|
|
217
217
|
/**
|
|
218
|
-
* @instance Wrapper over native
|
|
218
|
+
* @instance Wrapper over native {@link Date.toLocaleString} with improved type system.
|
|
219
219
|
* @description Converts a date and time to a string by using the current or specified locale.
|
|
220
220
|
*
|
|
221
|
-
* @param locales A locale string, array of locale strings,
|
|
221
|
+
* @param locales A locale string, array of locale strings, {@link Intl.Locale} object, or array of {@link Intl.Locale} objects that contain one or more language or locale tags (see: {@link LocalesArguments}). If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
|
222
222
|
* @param options An object that contains one or more properties that specify comparison options (see: {@link DateTimeFormatOptions}).
|
|
223
223
|
*/
|
|
224
224
|
toLocaleString(locales?: LocalesArguments, options?: DateTimeFormatOptions): string;
|
|
@@ -15,7 +15,7 @@ export declare const SECOND_FORMATS: readonly ["ss", "s"];
|
|
|
15
15
|
export declare const ZONE_FORMATS: readonly ["ZZ"];
|
|
16
16
|
export declare const MILLISECOND_FORMATS: readonly ["ms", "mss"];
|
|
17
17
|
export declare const TIME_FORMATS: readonly ["a", "A"];
|
|
18
|
-
export declare const SORTED_TIME_FORMATS: readonly ("MM" | "DD" | "D" | "Do" | "M" | "mmm" | "mmmm" | "d" | "dd" | "ddd" | "YYYY" | "YY" | "yyyy" | "yy" | "H" | "HH" | "hh" | "h" | "mm" | "m" | "a" | "A" | "ss" | "s" | "
|
|
18
|
+
export declare const SORTED_TIME_FORMATS: readonly ("MM" | "ms" | "DD" | "D" | "Do" | "M" | "mmm" | "mmmm" | "d" | "dd" | "ddd" | "YYYY" | "YY" | "yyyy" | "yy" | "H" | "HH" | "hh" | "h" | "mm" | "m" | "a" | "A" | "ss" | "s" | "mss" | "ZZ")[];
|
|
19
19
|
/** Ranges for day parts. */
|
|
20
20
|
export declare const DATE_PART_RANGES: Readonly<Record<DayPart, [ClockHour, ClockHour]>>;
|
|
21
21
|
/** Western Zodiac Signs */
|
|
@@ -41,4 +41,8 @@ export declare const TIME_UNIT_VARIANTS: Readonly<{
|
|
|
41
41
|
readonly millisecond: readonly ["ms", "msec", "msecs", "millisecond", "milliseconds"];
|
|
42
42
|
}>;
|
|
43
43
|
/** Map to different time units to milliseconds */
|
|
44
|
-
export declare const MS_MAP: Readonly<Record<"year" | "month" | "hour" | "minute" | "second" | "millisecond" | "day" | "
|
|
44
|
+
export declare const MS_MAP: Readonly<Record<"year" | "month" | "hour" | "minute" | "second" | "millisecond" | "day" | "ms" | "hr" | "d" | "h" | "m" | "s" | "week" | "min" | "y" | "yr" | "yrs" | "years" | "mo" | "months" | "w" | "weeks" | "days" | "hrs" | "hours" | "mins" | "minutes" | "sec" | "secs" | "seconds" | "msec" | "msecs" | "milliseconds", number>>;
|
|
45
|
+
/** List of locale calendars supported by {@link Intl} API */
|
|
46
|
+
export declare const LOCALE_CALENDARS: readonly ["buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", "gregory", "hebrew", "indian", "islamic", "islamic-civil", "islamic-rgsa", "islamic-tbla", "islamic-umalqura", "iso8601", "japanese", "persian", "roc"];
|
|
47
|
+
/** List of locale numbering systems supported by {@link Intl} API */
|
|
48
|
+
export declare const LOCALE_NUMBERING_SYSTEMS: readonly ["adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", "brah", "cakm", "cham", "deva", "diak", "fullwide", "gara", "gong", "gonm", "gujr", "gukh", "guru", "hanidec", "hmng", "hmnp", "java", "kali", "kawi", "khmr", "knda", "krai", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrepka", "mymrpao", "mymrshan", "mymrtlng", "nagm", "newa", "nkoo", "olck", "onao", "orya", "osma", "outlined", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", "sunu", "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "tnsa", "vaii", "wara", "wcho"];
|
package/dist/dts/date/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Enumerate, LocaleCode, NumberRange } from '../number/types';
|
|
2
2
|
import type { Maybe } from '../types/index';
|
|
3
|
-
import type { LooseLiteral, RangeTuple } from '../utils/types';
|
|
3
|
+
import type { LooseLiteral, RangeTuple, Split } from '../utils/types';
|
|
4
4
|
import type { Chronos } from './Chronos';
|
|
5
5
|
import type { ChronosStatics } from './chronos-statics';
|
|
6
|
-
import type { DATE_FORMATS, DAY_FORMATS, DAYS, HOUR_FORMATS, MILLISECOND_FORMATS, MINUTE_FORMATS, MONTH_FORMATS, MONTHS, SECOND_FORMATS, TIME_FORMATS, TIME_UNIT_VARIANTS, WESTERN_ZODIAC_SIGNS, YEAR_FORMATS, ZODIAC_PRESETS } from './constants';
|
|
6
|
+
import type { DATE_FORMATS, DAY_FORMATS, DAYS, HOUR_FORMATS, LOCALE_NUMBERING_SYSTEMS, MILLISECOND_FORMATS, MINUTE_FORMATS, MONTH_FORMATS, MONTHS, SECOND_FORMATS, LOCALE_CALENDARS, TIME_FORMATS, TIME_UNIT_VARIANTS, WESTERN_ZODIAC_SIGNS, YEAR_FORMATS, ZODIAC_PRESETS } from './constants';
|
|
7
7
|
import type { SEASON_PRESETS } from './seasons';
|
|
8
8
|
import type { TIME_ZONE_IDS, TIME_ZONE_LABELS, TIME_ZONES, TIME_ZONES_NATIVE } from './timezone';
|
|
9
9
|
export type { ChronosStatics, UTCOffset as UTCOffSet };
|
|
@@ -101,12 +101,22 @@ type DateTimeISO = 'YYYY-MM-DDTHH:mm:ss.mssZZ';
|
|
|
101
101
|
type DateTimeConnector = ' ' | ', ' | '; ' | ' - ';
|
|
102
102
|
/** Pre-defined literal types for formatting date and time. Optionally can pass any string. */
|
|
103
103
|
export type StrictFormat = LooseLiteral<DateTimeISO | DateParts | TimeParts | `${DateParts}${DateTimeConnector}${TimeParts}`>;
|
|
104
|
-
/**
|
|
105
|
-
export type
|
|
106
|
-
/**
|
|
104
|
+
/** `BCP47` locale string or {@link Intl.Locale} object that contain one or more language or locale tags */
|
|
105
|
+
export type $LocalArguments = LooseLiteral<LocaleCode | Split<LocaleCode, '-'>[0]> | Intl.Locale;
|
|
106
|
+
/** `BCP47` locale string, array of locale strings, {@link Intl.Locale} object, or array of {@link Intl.Locale} objects that contain one or more language or locale tags. */
|
|
107
|
+
export type LocalesArguments = $LocalArguments | $LocalArguments[];
|
|
108
|
+
/** Locale calendars supported by {@link Intl} API */
|
|
109
|
+
export type LocaleCalendar = (typeof LOCALE_CALENDARS)[number];
|
|
110
|
+
/** Locale numbering systems supported by {@link Intl} API */
|
|
111
|
+
export type NumberingSystem = (typeof LOCALE_NUMBERING_SYSTEMS)[number];
|
|
112
|
+
/** Extends {@link Intl.DateTimeFormatOptions} with improved type system. */
|
|
107
113
|
export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {
|
|
108
|
-
/** {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Time zone identifier} excluding `'Factory'
|
|
114
|
+
/** {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Time zone identifier} to use (excluding `'Factory'`). */
|
|
109
115
|
timeZone?: $TimeZoneIdentifier;
|
|
116
|
+
/** Locale calendar system to use. */
|
|
117
|
+
calendar?: LocaleCalendar;
|
|
118
|
+
/** Locale numbering system to use. */
|
|
119
|
+
numberingSystem?: NumberingSystem;
|
|
110
120
|
}
|
|
111
121
|
/** Iterable `Chronos` object properties */
|
|
112
122
|
export interface ChronosObject {
|
|
@@ -28,7 +28,7 @@ export declare function _checkUUIDVersion(value: unknown, v: `${$UUIDVersion}`):
|
|
|
28
28
|
* Prevents timing attacks by ensuring equal-time checks regardless of data differences.
|
|
29
29
|
*/
|
|
30
30
|
export declare function _constantTimeEquals(a: string | Uint8Array, b: string | Uint8Array): boolean;
|
|
31
|
-
/** Split string by substring length */
|
|
31
|
+
/** Split string by substring length, intended to be used internally for hex and binary converters only */
|
|
32
32
|
export declare function _splitByCharLength(str: string, splitByChars?: number): string[];
|
|
33
33
|
/** Pad start of a byte with 0 for `hex` or `binary` */
|
|
34
34
|
export declare function _padStartWith0(byte: number, type: 'hex' | 'binary'): string;
|
package/dist/dts/hash/utils.d.ts
CHANGED
|
@@ -344,7 +344,6 @@ export declare function intTo4BytesBE(n: number): Uint8Array;
|
|
|
344
344
|
* - Creating hex-encoded strings for APIs and protocols
|
|
345
345
|
*
|
|
346
346
|
* @see {@link hexToBytes} for reverse process
|
|
347
|
-
* @see {@link sha256Bytes} for raw byte hash results
|
|
348
347
|
*/
|
|
349
348
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
350
349
|
/**
|
|
@@ -363,8 +362,7 @@ export declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
363
362
|
* // Returns: Uint8Array []
|
|
364
363
|
*
|
|
365
364
|
* // Decode SHA-256 hash from hex
|
|
366
|
-
* const hashHex =
|
|
367
|
-
* '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824';
|
|
365
|
+
* const hashHex = '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824';
|
|
368
366
|
* const hashBytes = hexToBytes(hashHex);
|
|
369
367
|
* // Returns: Uint8Array(32)
|
|
370
368
|
* ```
|
|
@@ -385,6 +383,5 @@ export declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
385
383
|
* - Working with low-level protocols and binary APIs
|
|
386
384
|
*
|
|
387
385
|
* @see {@link bytesToHex} for the reverse process
|
|
388
|
-
* @see {@link isHexString} for input validation
|
|
389
386
|
*/
|
|
390
387
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
@@ -7,10 +7,10 @@ export declare const ORDINAL_UNDER_TEEN: Readonly<Record<string, string>>;
|
|
|
7
7
|
/** Ordinals that don't cleanly map by suffix alone */
|
|
8
8
|
export declare const ORDINAL_TO_CARDINAL: Readonly<Record<string, string>>;
|
|
9
9
|
/** List of ISO 4217 currency codes */
|
|
10
|
-
export declare const CURRENCY_CODES: readonly ["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KID", "KMF", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SOS", "SRD", "SSP", "STN", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TVD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VES", "VND", "VUV", "WST", "
|
|
10
|
+
export declare const CURRENCY_CODES: readonly ["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KID", "KMF", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SOS", "SRD", "SSP", "STN", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TVD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VES", "VND", "VUV", "WST", "YER", "ZAR", "ZMW", "ZWL"];
|
|
11
11
|
/** List of all supported BCP 47 locales */
|
|
12
12
|
export declare const LOCALE_CODES: readonly ["af-ZA", "am-ET", "ar-AE", "ar-BH", "ar-DZ", "ar-EG", "ar-IQ", "ar-JO", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-OM", "ar-QA", "ar-SA", "ar-SD", "ar-SY", "ar-TN", "ar-YE", "az-AZ", "be-BY", "bg-BG", "bn-BD", "bn-IN", "bs-BA", "ca-ES", "cs-CZ", "cy-GB", "da-DK", "de-AT", "de-CH", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-IE", "en-IN", "en-NZ", "en-PH", "en-SG", "en-US", "en-ZA", "es-AR", "es-BO", "es-CL", "es-CO", "es-CR", "es-DO", "es-EC", "es-ES", "es-GT", "es-HN", "es-MX", "es-NI", "es-PA", "es-PE", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "et-EE", "eu-ES", "fa-IR", "fi-FI", "fil-PH", "fr-BE", "fr-CA", "fr-CH", "fr-FR", "ga-IE", "gl-ES", "gu-IN", "he-IL", "hi-IN", "hr-HR", "hu-HU", "hy-AM", "id-ID", "is-IS", "it-CH", "it-IT", "ja-JP", "ka-GE", "kk-KZ", "km-KH", "kn-IN", "ko-KR", "ky-KG", "lt-LT", "lv-LV", "mk-MK", "ml-IN", "mn-MN", "mr-IN", "ms-MY", "mt-MT", "nb-NO", "ne-NP", "nl-BE", "nl-NL", "pl-PL", "pt-BR", "pt-PT", "ro-RO", "ru-RU", "sk-SK", "sl-SI", "sq-AL", "sr-Latn", "sv-SE", "sw-KE", "ta-IN", "te-IN", "th-TH", "tr-TR", "uk-UA", "ur-PK", "uz-UZ", "vi-VN", "zh-CN", "zh-HK", "zh-TW"];
|
|
13
|
-
/** Mapping of CurrencyCodes to LocaleCodes */
|
|
13
|
+
/** Mapping of CurrencyCodes to `LocaleCodes` */
|
|
14
14
|
export declare const CURRENCY_LOCALES: Readonly<{
|
|
15
15
|
readonly AED: "ar-AE";
|
|
16
16
|
readonly AFN: "fa-IR";
|
|
@@ -164,10 +164,6 @@ export declare const CURRENCY_LOCALES: Readonly<{
|
|
|
164
164
|
readonly VND: "vi-VN";
|
|
165
165
|
readonly VUV: "en-VU";
|
|
166
166
|
readonly WST: "en-WS";
|
|
167
|
-
readonly XAF: "fr-XAF";
|
|
168
|
-
readonly XCD: "en-XCD";
|
|
169
|
-
readonly XOF: "fr-XOF";
|
|
170
|
-
readonly XPF: "fr-XPF";
|
|
171
167
|
readonly YER: "ar-YE";
|
|
172
168
|
readonly ZAR: "en-ZA";
|
|
173
169
|
readonly ZMW: "en-ZM";
|
package/dist/esm/date/Chronos.js
CHANGED
|
@@ -213,7 +213,7 @@ export class Chronos {
|
|
|
213
213
|
return this.toDate().toISOString();
|
|
214
214
|
}
|
|
215
215
|
toLocaleString(locales, options) {
|
|
216
|
-
return this.
|
|
216
|
+
return this.#date.toLocaleString(locales, options);
|
|
217
217
|
}
|
|
218
218
|
getTimeStamp() {
|
|
219
219
|
return this.toDate().getTime();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chronos } from './Chronos.js';
|
|
2
|
-
const chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
2
|
+
const $chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
3
3
|
if (typeof valueOrYear === 'number' && typeof month === 'number') {
|
|
4
4
|
return new Chronos(valueOrYear, month, date ?? 1, hours ?? 0, minutes ?? 0, seconds ?? 0, ms ?? 0);
|
|
5
5
|
}
|
|
@@ -7,27 +7,25 @@ const chronos = (valueOrYear, month, date, hours, minutes, seconds, ms) => {
|
|
|
7
7
|
return new Chronos(valueOrYear);
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
function _isChronosStaticKey(prop) {
|
|
11
|
+
return (prop in Chronos &&
|
|
12
|
+
prop !== 'prototype' &&
|
|
13
|
+
prop !== 'name' &&
|
|
14
|
+
prop !== 'length' &&
|
|
15
|
+
typeof Chronos[prop] === 'function');
|
|
16
|
+
}
|
|
17
|
+
const chronosStatics = new Proxy($chronos, {
|
|
11
18
|
get(target, prop, receiver) {
|
|
12
19
|
if (prop in target) {
|
|
13
20
|
return Reflect.get(target, prop, receiver);
|
|
14
21
|
}
|
|
15
|
-
if (prop
|
|
16
|
-
prop !== 'prototype' &&
|
|
17
|
-
prop !== 'name' &&
|
|
18
|
-
prop !== 'length' &&
|
|
19
|
-
typeof Chronos[prop] === 'function') {
|
|
22
|
+
if (_isChronosStaticKey(prop)) {
|
|
20
23
|
return Chronos[prop];
|
|
21
24
|
}
|
|
22
25
|
return Reflect.get(target, prop, receiver);
|
|
23
26
|
},
|
|
24
27
|
has(target, prop) {
|
|
25
|
-
return
|
|
26
|
-
(prop in Chronos &&
|
|
27
|
-
prop !== 'prototype' &&
|
|
28
|
-
prop !== 'name' &&
|
|
29
|
-
prop !== 'length' &&
|
|
30
|
-
typeof Chronos[prop] === 'function'));
|
|
28
|
+
return prop in target || _isChronosStaticKey(prop);
|
|
31
29
|
},
|
|
32
30
|
});
|
|
33
31
|
export { chronosStatics as chronos };
|
|
@@ -148,3 +148,102 @@ export const MS_MAP = /* @__PURE__ */ Object.freeze((() => {
|
|
|
148
148
|
milliseconds: 1,
|
|
149
149
|
};
|
|
150
150
|
})());
|
|
151
|
+
export const LOCALE_CALENDARS = /* @__PURE__ */ Object.freeze([
|
|
152
|
+
'buddhist',
|
|
153
|
+
'chinese',
|
|
154
|
+
'coptic',
|
|
155
|
+
'dangi',
|
|
156
|
+
'ethioaa',
|
|
157
|
+
'ethiopic',
|
|
158
|
+
'gregory',
|
|
159
|
+
'hebrew',
|
|
160
|
+
'indian',
|
|
161
|
+
'islamic',
|
|
162
|
+
'islamic-civil',
|
|
163
|
+
'islamic-rgsa',
|
|
164
|
+
'islamic-tbla',
|
|
165
|
+
'islamic-umalqura',
|
|
166
|
+
'iso8601',
|
|
167
|
+
'japanese',
|
|
168
|
+
'persian',
|
|
169
|
+
'roc',
|
|
170
|
+
]);
|
|
171
|
+
export const LOCALE_NUMBERING_SYSTEMS = /* @__PURE__ */ Object.freeze([
|
|
172
|
+
'adlm',
|
|
173
|
+
'ahom',
|
|
174
|
+
'arab',
|
|
175
|
+
'arabext',
|
|
176
|
+
'bali',
|
|
177
|
+
'beng',
|
|
178
|
+
'bhks',
|
|
179
|
+
'brah',
|
|
180
|
+
'cakm',
|
|
181
|
+
'cham',
|
|
182
|
+
'deva',
|
|
183
|
+
'diak',
|
|
184
|
+
'fullwide',
|
|
185
|
+
'gara',
|
|
186
|
+
'gong',
|
|
187
|
+
'gonm',
|
|
188
|
+
'gujr',
|
|
189
|
+
'gukh',
|
|
190
|
+
'guru',
|
|
191
|
+
'hanidec',
|
|
192
|
+
'hmng',
|
|
193
|
+
'hmnp',
|
|
194
|
+
'java',
|
|
195
|
+
'kali',
|
|
196
|
+
'kawi',
|
|
197
|
+
'khmr',
|
|
198
|
+
'knda',
|
|
199
|
+
'krai',
|
|
200
|
+
'lana',
|
|
201
|
+
'lanatham',
|
|
202
|
+
'laoo',
|
|
203
|
+
'latn',
|
|
204
|
+
'lepc',
|
|
205
|
+
'limb',
|
|
206
|
+
'mathbold',
|
|
207
|
+
'mathdbl',
|
|
208
|
+
'mathmono',
|
|
209
|
+
'mathsanb',
|
|
210
|
+
'mathsans',
|
|
211
|
+
'mlym',
|
|
212
|
+
'modi',
|
|
213
|
+
'mong',
|
|
214
|
+
'mroo',
|
|
215
|
+
'mtei',
|
|
216
|
+
'mymr',
|
|
217
|
+
'mymrepka',
|
|
218
|
+
'mymrpao',
|
|
219
|
+
'mymrshan',
|
|
220
|
+
'mymrtlng',
|
|
221
|
+
'nagm',
|
|
222
|
+
'newa',
|
|
223
|
+
'nkoo',
|
|
224
|
+
'olck',
|
|
225
|
+
'onao',
|
|
226
|
+
'orya',
|
|
227
|
+
'osma',
|
|
228
|
+
'outlined',
|
|
229
|
+
'rohg',
|
|
230
|
+
'saur',
|
|
231
|
+
'segment',
|
|
232
|
+
'shrd',
|
|
233
|
+
'sind',
|
|
234
|
+
'sinh',
|
|
235
|
+
'sora',
|
|
236
|
+
'sund',
|
|
237
|
+
'sunu',
|
|
238
|
+
'takr',
|
|
239
|
+
'talu',
|
|
240
|
+
'tamldec',
|
|
241
|
+
'telu',
|
|
242
|
+
'thai',
|
|
243
|
+
'tibt',
|
|
244
|
+
'tirh',
|
|
245
|
+
'tnsa',
|
|
246
|
+
'vaii',
|
|
247
|
+
'wara',
|
|
248
|
+
'wcho',
|
|
249
|
+
]);
|
|
@@ -240,10 +240,6 @@ export const CURRENCY_CODES = /* @__PURE__ */ Object.freeze([
|
|
|
240
240
|
'VND',
|
|
241
241
|
'VUV',
|
|
242
242
|
'WST',
|
|
243
|
-
'XAF',
|
|
244
|
-
'XCD',
|
|
245
|
-
'XOF',
|
|
246
|
-
'XPF',
|
|
247
243
|
'YER',
|
|
248
244
|
'ZAR',
|
|
249
245
|
'ZMW',
|
|
@@ -529,10 +525,6 @@ export const CURRENCY_LOCALES = /* @__PURE__ */ Object.freeze({
|
|
|
529
525
|
VND: 'vi-VN',
|
|
530
526
|
VUV: 'en-VU',
|
|
531
527
|
WST: 'en-WS',
|
|
532
|
-
XAF: 'fr-XAF',
|
|
533
|
-
XCD: 'en-XCD',
|
|
534
|
-
XOF: 'fr-XOF',
|
|
535
|
-
XPF: 'fr-XPF',
|
|
536
528
|
YER: 'ar-YE',
|
|
537
529
|
ZAR: 'en-ZA',
|
|
538
530
|
ZMW: 'en-ZM',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.28.
|
|
3
|
+
"version": "4.28.44",
|
|
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",
|
|
@@ -29,8 +29,13 @@
|
|
|
29
29
|
"contributors": [
|
|
30
30
|
{
|
|
31
31
|
"name": "Nazmul Hassan",
|
|
32
|
-
"email": "
|
|
32
|
+
"email": "nazmulnhb007@yahoo.com",
|
|
33
33
|
"url": "https://github.com/nazmul-nhb"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "Nazmul Hassan",
|
|
37
|
+
"email": "nazmulnhb@gmail.com",
|
|
38
|
+
"url": "https://github.com/nhb-nazmul"
|
|
34
39
|
}
|
|
35
40
|
],
|
|
36
41
|
"bugs": {
|
|
@@ -41,9 +46,9 @@
|
|
|
41
46
|
"devDependencies": {
|
|
42
47
|
"@eslint/js": "^9.39.2",
|
|
43
48
|
"@types/jest": "^30.0.0",
|
|
44
|
-
"@types/node": "^25.0.
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
46
|
-
"@typescript-eslint/parser": "^8.
|
|
49
|
+
"@types/node": "^25.0.3",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
51
|
+
"@typescript-eslint/parser": "^8.50.0",
|
|
47
52
|
"eslint": "^9.39.2",
|
|
48
53
|
"eslint-config-prettier": "^10.1.8",
|
|
49
54
|
"eslint-plugin-prettier": "^5.5.4",
|
|
@@ -51,11 +56,11 @@
|
|
|
51
56
|
"husky": "^9.1.7",
|
|
52
57
|
"jest": "^30.2.0",
|
|
53
58
|
"lint-staged": "^16.2.7",
|
|
54
|
-
"nhb-scripts": "^1.9.
|
|
59
|
+
"nhb-scripts": "^1.9.2",
|
|
55
60
|
"prettier": "^3.7.4",
|
|
56
61
|
"ts-jest": "^29.4.6",
|
|
57
62
|
"typescript": "^5.9.3",
|
|
58
|
-
"typescript-eslint": "^8.
|
|
63
|
+
"typescript-eslint": "^8.50.0"
|
|
59
64
|
},
|
|
60
65
|
"keywords": [
|
|
61
66
|
"toolbox",
|