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
package/dist/types.d.cts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $ as $
|
|
17
|
+
import { $ as $UTCOffset, $t as BanglaDateOptions, A as ChronosMethods, At as TimeZone, B as RelativeRangeOptions, Bt as WeekDay, C as ZodiacSign, Ct as NegativeUTCHour, D as $StaticMethods, Dt as TimeUnit, E as $PluginMethods, Et as Quarter, F as DateRangeOptions, Ft as TimeZoneName, G as $ISOTimeString, Gt as $BanglaYear, H as WithoutOrigin, I as DatesInRangeOptions, It as TimeZoneNameNative, J as $TZLabelKey, Jt as $BnMonthPadded, K as $LocalArguments, Kt as $BnDatePadded, L as PluginMethods, Lt as TimestampOptions, M as ChronosProperties, Mt as TimeZoneId, N as ChronosTimeZone, Nt as TimeZoneIdNative, O as ChronosInput, Ot as TimeUnitValue, P as ChronosWithOptions, Pt as TimeZoneIdentifier, Q as $TimeZoneIdentifier, Qt as BanglaDateObject, R as RangeWithDates, Rt as UTCMinute, S as ZodiacPreset, St as MonthString, T as $InstanceMethods, Tt as PositiveUTCHour, U as $DateUnit, Ut as $BanglaMonth, V as WeekdayOptions, W as $GMTOffset, Wt as $BanglaMonthDate, X as $TimeUnitVar, Xt as BanglaDate, Y as $TimeUnitKey, Yt as $BnYearPadded, Z as $TimeUnitVarMap, Zt as BanglaDateFormat, _ as TimeDuration, _n as SecondToken, _t as LocaleCalendar, a as BusinessOptionsBasic, an as BnCalendarConfig, at as ClockTime, b as ZodiacMetaOptions, bn as TimeToken, bt as MonthDateString, c as DateBoundary, cn as DateFormatToken, ct as DateLike, d as DurationKey, dn as FormatToken, dt as FormatOptions, en as BanglaDayName, et as $UnitAnyCase, f as DurationOptions, fn as HourToken, ft as FromNowUnit, g as SeasonPreset, gn as SafeFormat, gt as ISODateTimeString, h as SeasonOptions, hn as MonthToken, ht as ISODateFormat, i as AcademicYear, in as BanglaYear, it as ClockSecond, j as ChronosObject, jt as TimeZoneDetails, k as ChronosInternals, kt as TimeWithUnit, l as DayPart, ln as DateToken, lt as DateString, m as SeasonDefinition, mn as MinuteToken, mt as HourMinutes, n as $BusinessHourBaseOptions, nn as BanglaMonthName, nt as ClockHour, o as BusinessOptionsWeekends, on as BnCalendarVariant, ot as DateArgs, p as MonthBoundary, pn as MSToken, pt as GreetingConfigs, q as $NativeTzNameOrId, qt as $BnEn, r as $BusinessHourOptions, rn as BanglaSeasonName, rt as ClockMinute, s as ChronosPlugin, sn as DateWithSeasonToken, st as DateFormatOptions, t as ChronosStatics, tn as BanglaMonth, tt as ChronosStaticKey, u as DayPartConfig, un as DayToken, ut as DateTimeFormatOptions, v as ZodiacArray, vn as TimeFormatToken, vt as LocalesArguments, w as $Chronos, wt as NumberingSystem, x as ZodiacOptions, xn as YearToken, xt as MonthName, y as ZodiacMeta, yn as TimeOnlyFormat, yt as Milliseconds, z as RelativeDateRange, zt as UTCOffset } from "./types-zhhEJ8N7.cjs";
|
|
18
18
|
export type { $BanglaMonth, $BanglaMonthDate, $BanglaYear, $BnDatePadded, $BnEn, $BnMonthPadded, $BnYearPadded, $BusinessHourBaseOptions, $BusinessHourOptions, $Chronos, $DateUnit, $GMTOffset, $ISOTimeString, $InstanceMethods, $LocalArguments, $NativeTzNameOrId, $PluginMethods, $StaticMethods, $TZLabelKey, $TimeUnitKey, $TimeUnitVar, $TimeUnitVarMap, $TimeZoneIdentifier, $UTCOffset, $UnitAnyCase, AcademicYear, BanglaDate, BanglaDateFormat, BanglaDateObject, BanglaDateOptions, BanglaDayName, BanglaMonth, BanglaMonthName, BanglaSeasonName, BanglaYear, BnCalendarConfig, BnCalendarVariant, BusinessOptionsBasic, BusinessOptionsWeekends, ChronosInput, ChronosInternals, ChronosMethods, ChronosObject, ChronosPlugin, ChronosProperties, ChronosStaticKey, ChronosStatics, ChronosTimeZone, ChronosWithOptions, ClockHour, ClockMinute, ClockSecond, ClockTime, DateArgs, DateBoundary, DateFormatOptions, DateFormatToken, DateLike, DateRangeOptions, DateString, DateTimeFormatOptions, DateToken, DateWithSeasonToken, DatesInRangeOptions, DayPart, DayPartConfig, DayToken, DurationKey, DurationOptions, FormatOptions, FormatToken, FromNowUnit, GreetingConfigs, HourMinutes, HourToken, ISODateFormat, ISODateTimeString, LocaleCalendar, LocalesArguments, MSToken, Milliseconds, MinuteToken, MonthBoundary, MonthDateString, MonthName, MonthString, MonthToken, NegativeUTCHour, NumberingSystem, PluginMethods, PositiveUTCHour, Quarter, RangeWithDates, RelativeDateRange, RelativeRangeOptions, SafeFormat, SeasonDefinition, SeasonOptions, SeasonPreset, SecondToken, TimeDuration, TimeFormatToken, TimeOnlyFormat, TimeToken, TimeUnit, TimeUnitValue, TimeWithUnit, TimeZone, TimeZoneDetails, TimeZoneId, TimeZoneIdNative, TimeZoneIdentifier, TimeZoneName, TimeZoneNameNative, TimestampOptions, UTCMinute, UTCOffset, WeekDay, WeekdayOptions, WithoutOrigin, YearToken, ZodiacArray, ZodiacMeta, ZodiacMetaOptions, ZodiacOptions, ZodiacPreset, ZodiacSign };
|
package/dist/types.d.mts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $ as $
|
|
17
|
+
import { $ as $UTCOffset, $t as BanglaDateOptions, A as ChronosMethods, At as TimeZone, B as RelativeRangeOptions, Bt as WeekDay, C as ZodiacSign, Ct as NegativeUTCHour, D as $StaticMethods, Dt as TimeUnit, E as $PluginMethods, Et as Quarter, F as DateRangeOptions, Ft as TimeZoneName, G as $ISOTimeString, Gt as $BanglaYear, H as WithoutOrigin, I as DatesInRangeOptions, It as TimeZoneNameNative, J as $TZLabelKey, Jt as $BnMonthPadded, K as $LocalArguments, Kt as $BnDatePadded, L as PluginMethods, Lt as TimestampOptions, M as ChronosProperties, Mt as TimeZoneId, N as ChronosTimeZone, Nt as TimeZoneIdNative, O as ChronosInput, Ot as TimeUnitValue, P as ChronosWithOptions, Pt as TimeZoneIdentifier, Q as $TimeZoneIdentifier, Qt as BanglaDateObject, R as RangeWithDates, Rt as UTCMinute, S as ZodiacPreset, St as MonthString, T as $InstanceMethods, Tt as PositiveUTCHour, U as $DateUnit, Ut as $BanglaMonth, V as WeekdayOptions, W as $GMTOffset, Wt as $BanglaMonthDate, X as $TimeUnitVar, Xt as BanglaDate, Y as $TimeUnitKey, Yt as $BnYearPadded, Z as $TimeUnitVarMap, Zt as BanglaDateFormat, _ as TimeDuration, _n as SecondToken, _t as LocaleCalendar, a as BusinessOptionsBasic, an as BnCalendarConfig, at as ClockTime, b as ZodiacMetaOptions, bn as TimeToken, bt as MonthDateString, c as DateBoundary, cn as DateFormatToken, ct as DateLike, d as DurationKey, dn as FormatToken, dt as FormatOptions, en as BanglaDayName, et as $UnitAnyCase, f as DurationOptions, fn as HourToken, ft as FromNowUnit, g as SeasonPreset, gn as SafeFormat, gt as ISODateTimeString, h as SeasonOptions, hn as MonthToken, ht as ISODateFormat, i as AcademicYear, in as BanglaYear, it as ClockSecond, j as ChronosObject, jt as TimeZoneDetails, k as ChronosInternals, kt as TimeWithUnit, l as DayPart, ln as DateToken, lt as DateString, m as SeasonDefinition, mn as MinuteToken, mt as HourMinutes, n as $BusinessHourBaseOptions, nn as BanglaMonthName, nt as ClockHour, o as BusinessOptionsWeekends, on as BnCalendarVariant, ot as DateArgs, p as MonthBoundary, pn as MSToken, pt as GreetingConfigs, q as $NativeTzNameOrId, qt as $BnEn, r as $BusinessHourOptions, rn as BanglaSeasonName, rt as ClockMinute, s as ChronosPlugin, sn as DateWithSeasonToken, st as DateFormatOptions, t as ChronosStatics, tn as BanglaMonth, tt as ChronosStaticKey, u as DayPartConfig, un as DayToken, ut as DateTimeFormatOptions, v as ZodiacArray, vn as TimeFormatToken, vt as LocalesArguments, w as $Chronos, wt as NumberingSystem, x as ZodiacOptions, xn as YearToken, xt as MonthName, y as ZodiacMeta, yn as TimeOnlyFormat, yt as Milliseconds, z as RelativeDateRange, zt as UTCOffset } from "./types-CiFnGEL8.mjs";
|
|
18
18
|
export type { $BanglaMonth, $BanglaMonthDate, $BanglaYear, $BnDatePadded, $BnEn, $BnMonthPadded, $BnYearPadded, $BusinessHourBaseOptions, $BusinessHourOptions, $Chronos, $DateUnit, $GMTOffset, $ISOTimeString, $InstanceMethods, $LocalArguments, $NativeTzNameOrId, $PluginMethods, $StaticMethods, $TZLabelKey, $TimeUnitKey, $TimeUnitVar, $TimeUnitVarMap, $TimeZoneIdentifier, $UTCOffset, $UnitAnyCase, AcademicYear, BanglaDate, BanglaDateFormat, BanglaDateObject, BanglaDateOptions, BanglaDayName, BanglaMonth, BanglaMonthName, BanglaSeasonName, BanglaYear, BnCalendarConfig, BnCalendarVariant, BusinessOptionsBasic, BusinessOptionsWeekends, ChronosInput, ChronosInternals, ChronosMethods, ChronosObject, ChronosPlugin, ChronosProperties, ChronosStaticKey, ChronosStatics, ChronosTimeZone, ChronosWithOptions, ClockHour, ClockMinute, ClockSecond, ClockTime, DateArgs, DateBoundary, DateFormatOptions, DateFormatToken, DateLike, DateRangeOptions, DateString, DateTimeFormatOptions, DateToken, DateWithSeasonToken, DatesInRangeOptions, DayPart, DayPartConfig, DayToken, DurationKey, DurationOptions, FormatOptions, FormatToken, FromNowUnit, GreetingConfigs, HourMinutes, HourToken, ISODateFormat, ISODateTimeString, LocaleCalendar, LocalesArguments, MSToken, Milliseconds, MinuteToken, MonthBoundary, MonthDateString, MonthName, MonthString, MonthToken, NegativeUTCHour, NumberingSystem, PluginMethods, PositiveUTCHour, Quarter, RangeWithDates, RelativeDateRange, RelativeRangeOptions, SafeFormat, SeasonDefinition, SeasonOptions, SeasonPreset, SecondToken, TimeDuration, TimeFormatToken, TimeOnlyFormat, TimeToken, TimeUnit, TimeUnitValue, TimeWithUnit, TimeZone, TimeZoneDetails, TimeZoneId, TimeZoneIdNative, TimeZoneIdentifier, TimeZoneName, TimeZoneNameNative, TimestampOptions, UTCMinute, UTCOffset, WeekDay, WeekdayOptions, WithoutOrigin, YearToken, ZodiacArray, ZodiacMeta, ZodiacMetaOptions, ZodiacOptions, ZodiacPreset, ZodiacSign };
|
|
@@ -15,13 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { n as NATIVE_TZ_IDS } from "./timezone-Db2CeL32.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { r as isObject } from "./non-primitives-CbAOB6lb.mjs";
|
|
20
|
-
import { n as normalizeNumber } from "./utilities-BnHD2hHf.mjs";
|
|
18
|
+
import { _ as isUndefined, i as normalizeNumber, l as isObject } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
21
19
|
import { isValidUTCOffset } from "./guards.mjs";
|
|
22
|
-
import { n as _dateArgsToDate, p as _resolveNativeTzName, r as _formatDate, s as _gmtToUtcOffset, u as _normalizeOffset } from "./helpers-
|
|
20
|
+
import { n as _dateArgsToDate, p as _resolveNativeTzName, r as _formatDate, s as _gmtToUtcOffset, u as _normalizeOffset } from "./helpers-t49KkxOE.mjs";
|
|
23
21
|
|
|
24
|
-
//#region src/utils
|
|
22
|
+
//#region src/utilities/utils.ts
|
|
25
23
|
/**
|
|
26
24
|
* * Extracts the hour and minute from a time string in `HH:MM` or `-HH:MM` format.
|
|
27
25
|
*
|
|
@@ -15,13 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_timezone = require('./timezone-BNnHFgki.cjs');
|
|
18
|
-
const
|
|
19
|
-
const require_non_primitives = require('./non-primitives-BqjRwK2B.cjs');
|
|
20
|
-
const require_utilities = require('./utilities-C_KmjIRK.cjs');
|
|
18
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
21
19
|
const require_guards = require('./guards.cjs');
|
|
22
|
-
const require_helpers = require('./helpers-
|
|
20
|
+
const require_helpers = require('./helpers-BMDeRLjO.cjs');
|
|
23
21
|
|
|
24
|
-
//#region src/utils
|
|
22
|
+
//#region src/utilities/utils.ts
|
|
25
23
|
/**
|
|
26
24
|
* * Extracts the hour and minute from a time string in `HH:MM` or `-HH:MM` format.
|
|
27
25
|
*
|
|
@@ -75,8 +73,8 @@ function extractMinutesFromUTC(utc) {
|
|
|
75
73
|
* convertMinutesToTime(-45); // "0:45"
|
|
76
74
|
*/
|
|
77
75
|
function convertMinutesToTime(minutes) {
|
|
78
|
-
const parsed =
|
|
79
|
-
if (
|
|
76
|
+
const parsed = require_convert_C8LsoKmI.normalizeNumber(minutes);
|
|
77
|
+
if (require_convert_C8LsoKmI.isUndefined(parsed)) throw new TypeError(`Invalid numeric input!`, { cause: `${minutes} cannot be converted to a number.` });
|
|
80
78
|
const numMIn = Math.abs(parsed);
|
|
81
79
|
return `${String(Math.floor(numMIn / 60))}:${String(numMIn % 60).padStart(2, "0")}`;
|
|
82
80
|
}
|
|
@@ -87,8 +85,8 @@ function convertMinutesToTime(minutes) {
|
|
|
87
85
|
* @returns A formatted UTC offset string like `UTC+05:30` or `UTC-04:00`.
|
|
88
86
|
*/
|
|
89
87
|
function formatUTCOffset(minutes) {
|
|
90
|
-
const parsed =
|
|
91
|
-
if (
|
|
88
|
+
const parsed = require_convert_C8LsoKmI.normalizeNumber(minutes);
|
|
89
|
+
if (require_convert_C8LsoKmI.isUndefined(parsed)) throw new TypeError(`Invalid numeric input!`, { cause: `${minutes} cannot be converted to a number.` });
|
|
92
90
|
const sign = parsed < 0 ? "-" : "+";
|
|
93
91
|
const abs = Math.abs(parsed);
|
|
94
92
|
return `UTC${sign}${String(Math.floor(abs / 60)).padStart(2, "0")}:${String(abs % 60).padStart(2, "0")}`;
|
|
@@ -233,7 +231,7 @@ function getTimestamp(args, format) {
|
|
|
233
231
|
let $value;
|
|
234
232
|
let $format;
|
|
235
233
|
const _isTsOptions = (opt) => {
|
|
236
|
-
return
|
|
234
|
+
return require_convert_C8LsoKmI.isObject(opt) && ("value" in opt || "format" in opt);
|
|
237
235
|
};
|
|
238
236
|
if (_isTsOptions(args)) {
|
|
239
237
|
$value = args.value || /* @__PURE__ */ new Date();
|
package/dist/utils.cjs
CHANGED
|
@@ -16,13 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_basic = require('./basic-DsQqC5nZ.cjs');
|
|
19
|
-
const
|
|
20
|
-
const require_utilities = require('./utilities-C_KmjIRK.cjs');
|
|
19
|
+
const require_convert_C8LsoKmI = require('./convert-C8LsoKmI-uBhT5hZQ.cjs');
|
|
21
20
|
const require_guards = require('./guards.cjs');
|
|
22
|
-
const
|
|
23
|
-
const require_greet = require('./greet-
|
|
21
|
+
const require_utils = require('./utils-S_aw0TeC.cjs');
|
|
22
|
+
const require_greet = require('./greet-Brz0CVv1.cjs');
|
|
24
23
|
|
|
25
|
-
//#region src/
|
|
24
|
+
//#region src/utilities/parser.ts
|
|
26
25
|
/**
|
|
27
26
|
* * Parse the given value to milliseconds or optionally to seconds.
|
|
28
27
|
*
|
|
@@ -35,7 +34,7 @@ const require_greet = require('./greet-CMkwXJ7o.cjs');
|
|
|
35
34
|
* - If you use time value with unit ({@link TimeWithUnit}) be sure you provide the time units (days, hours, etc.), otherwise it will return `NaN`, e.g., `'120 unknown'` will return `NaN`.
|
|
36
35
|
*/
|
|
37
36
|
function parseMSec(value, sec = false) {
|
|
38
|
-
if (
|
|
37
|
+
if (require_convert_C8LsoKmI.isNumber(value) || require_convert_C8LsoKmI.isNumericString(value)) return _parse(`${value}s`, sec);
|
|
39
38
|
else if (require_guards.isTimeWithUnit(value)) return _parse(value, sec);
|
|
40
39
|
else return NaN;
|
|
41
40
|
}
|
|
@@ -47,7 +46,7 @@ function parseMSec(value, sec = false) {
|
|
|
47
46
|
* @returns The parsed value in milliseconds (or seconds if specified), or `NaN` if the string can't be parsed.
|
|
48
47
|
*/
|
|
49
48
|
function _parse(str, sec = false) {
|
|
50
|
-
if (!
|
|
49
|
+
if (!require_convert_C8LsoKmI.isNonEmptyString(str) || str.length > 100) throw new RangeError(`Value must be a string with length between 1 and 99!`);
|
|
51
50
|
const match = /^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(str);
|
|
52
51
|
if (!match?.groups) return NaN;
|
|
53
52
|
const unit = (match.groups.unit ?? "ms").toLowerCase();
|
|
@@ -58,35 +57,35 @@ function _parse(str, sec = false) {
|
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
//#endregion
|
|
61
|
-
exports.convertMinutesToHourMinutes =
|
|
62
|
-
exports.convertMinutesToTime =
|
|
63
|
-
exports.convertMinutesToUTCOffset =
|
|
64
|
-
exports.extractHourMinute =
|
|
65
|
-
exports.extractMinutesFromUTC =
|
|
66
|
-
exports.extractTimeFromUTC =
|
|
67
|
-
exports.extractTimeStringFromUTC =
|
|
68
|
-
exports.extractTotalMinutesFromTime =
|
|
69
|
-
exports.formatDate =
|
|
70
|
-
exports.formatDateRelative =
|
|
71
|
-
exports.formatDateTime =
|
|
72
|
-
exports.formatRelativeDate =
|
|
73
|
-
exports.formatRelativeTime =
|
|
74
|
-
exports.formatTimePart =
|
|
75
|
-
exports.formatUTCOffset =
|
|
60
|
+
exports.convertMinutesToHourMinutes = require_utils.convertMinutesToTime;
|
|
61
|
+
exports.convertMinutesToTime = require_utils.convertMinutesToTime;
|
|
62
|
+
exports.convertMinutesToUTCOffset = require_utils.formatUTCOffset;
|
|
63
|
+
exports.extractHourMinute = require_utils.extractHourMinute;
|
|
64
|
+
exports.extractMinutesFromUTC = require_utils.extractMinutesFromUTC;
|
|
65
|
+
exports.extractTimeFromUTC = require_utils.extractTimeFromUTC;
|
|
66
|
+
exports.extractTimeStringFromUTC = require_utils.extractTimeFromUTC;
|
|
67
|
+
exports.extractTotalMinutesFromTime = require_utils.getTotalMinutes;
|
|
68
|
+
exports.formatDate = require_utils.formatDate;
|
|
69
|
+
exports.formatDateRelative = require_utils.formatDateRelative;
|
|
70
|
+
exports.formatDateTime = require_utils.formatDate;
|
|
71
|
+
exports.formatRelativeDate = require_utils.formatDateRelative;
|
|
72
|
+
exports.formatRelativeTime = require_utils.formatDateRelative;
|
|
73
|
+
exports.formatTimePart = require_utils.formatTimePart;
|
|
74
|
+
exports.formatUTCOffset = require_utils.formatUTCOffset;
|
|
76
75
|
exports.generateGreeting = require_greet.getGreeting;
|
|
77
76
|
exports.getGreeting = require_greet.getGreeting;
|
|
78
|
-
exports.getHourMinutesFromMinutes =
|
|
79
|
-
exports.getMinutesFromUTC =
|
|
80
|
-
exports.getNativeTimeZoneId =
|
|
81
|
-
exports.getTimeFromMinutes =
|
|
82
|
-
exports.getTimeStringFromUTC =
|
|
83
|
-
exports.getTimeZoneDetails =
|
|
84
|
-
exports.getTimeZoneIds =
|
|
85
|
-
exports.getTimestamp =
|
|
86
|
-
exports.getTotalMinutes =
|
|
87
|
-
exports.getTotalMinutesFromTime =
|
|
88
|
-
exports.getTotalMinutesFromUTC =
|
|
77
|
+
exports.getHourMinutesFromMinutes = require_utils.convertMinutesToTime;
|
|
78
|
+
exports.getMinutesFromUTC = require_utils.extractMinutesFromUTC;
|
|
79
|
+
exports.getNativeTimeZoneId = require_utils.getNativeTimeZoneId;
|
|
80
|
+
exports.getTimeFromMinutes = require_utils.convertMinutesToTime;
|
|
81
|
+
exports.getTimeStringFromUTC = require_utils.extractTimeFromUTC;
|
|
82
|
+
exports.getTimeZoneDetails = require_utils.getTimeZoneDetails;
|
|
83
|
+
exports.getTimeZoneIds = require_utils.getTimeZoneIds;
|
|
84
|
+
exports.getTimestamp = require_utils.getTimestamp;
|
|
85
|
+
exports.getTotalMinutes = require_utils.getTotalMinutes;
|
|
86
|
+
exports.getTotalMinutesFromTime = require_utils.getTotalMinutes;
|
|
87
|
+
exports.getTotalMinutesFromUTC = require_utils.extractMinutesFromUTC;
|
|
89
88
|
exports.greet = require_greet.getGreeting;
|
|
90
|
-
exports.minutesToUTCOffset =
|
|
89
|
+
exports.minutesToUTCOffset = require_utils.formatUTCOffset;
|
|
91
90
|
exports.parseMSec = parseMSec;
|
|
92
91
|
exports.parseMs = parseMSec;
|
package/dist/utils.d.cts
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { En as Numeric, Lt as TimestampOptions, Nt as TimeZoneIdNative, Q as $TimeZoneIdentifier, at as ClockTime, gn as SafeFormat, gt as ISODateTimeString, ht as ISODateFormat, jt as TimeZoneDetails, kt as TimeWithUnit, mt as HourMinutes, ot as DateArgs, pt as GreetingConfigs, st as DateFormatOptions, wn as Maybe, yn as TimeOnlyFormat, zt as UTCOffset } from "./types-zhhEJ8N7.cjs";
|
|
18
18
|
|
|
19
|
-
//#region src/
|
|
19
|
+
//#region src/utilities/greet.d.ts
|
|
20
20
|
/**
|
|
21
21
|
* * Returns a greeting message based on the provided time or current time.
|
|
22
22
|
*
|
|
@@ -25,7 +25,7 @@ import { At as TimeZoneDetails, Cn as Numeric, It as TimestampOptions, Mt as Tim
|
|
|
25
25
|
*/
|
|
26
26
|
declare function getGreeting(configs?: GreetingConfigs): string;
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region src/
|
|
28
|
+
//#region src/utilities/parser.d.ts
|
|
29
29
|
/**
|
|
30
30
|
* * Parse the given value to milliseconds or optionally to seconds.
|
|
31
31
|
*
|
|
@@ -39,7 +39,7 @@ declare function getGreeting(configs?: GreetingConfigs): string;
|
|
|
39
39
|
*/
|
|
40
40
|
declare function parseMSec(value: TimeWithUnit | Numeric, sec?: boolean): number;
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region src/utils
|
|
42
|
+
//#region src/utilities/utils.d.ts
|
|
43
43
|
/**
|
|
44
44
|
* * Extracts the hour and minute from a time string in `HH:MM` or `-HH:MM` format.
|
|
45
45
|
*
|
package/dist/utils.d.mts
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { En as Numeric, Lt as TimestampOptions, Nt as TimeZoneIdNative, Q as $TimeZoneIdentifier, at as ClockTime, gn as SafeFormat, gt as ISODateTimeString, ht as ISODateFormat, jt as TimeZoneDetails, kt as TimeWithUnit, mt as HourMinutes, ot as DateArgs, pt as GreetingConfigs, st as DateFormatOptions, wn as Maybe, yn as TimeOnlyFormat, zt as UTCOffset } from "./types-CiFnGEL8.mjs";
|
|
18
18
|
|
|
19
|
-
//#region src/
|
|
19
|
+
//#region src/utilities/greet.d.ts
|
|
20
20
|
/**
|
|
21
21
|
* * Returns a greeting message based on the provided time or current time.
|
|
22
22
|
*
|
|
@@ -25,7 +25,7 @@ import { At as TimeZoneDetails, Cn as Numeric, It as TimestampOptions, Mt as Tim
|
|
|
25
25
|
*/
|
|
26
26
|
declare function getGreeting(configs?: GreetingConfigs): string;
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region src/
|
|
28
|
+
//#region src/utilities/parser.d.ts
|
|
29
29
|
/**
|
|
30
30
|
* * Parse the given value to milliseconds or optionally to seconds.
|
|
31
31
|
*
|
|
@@ -39,7 +39,7 @@ declare function getGreeting(configs?: GreetingConfigs): string;
|
|
|
39
39
|
*/
|
|
40
40
|
declare function parseMSec(value: TimeWithUnit | Numeric, sec?: boolean): number;
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region src/utils
|
|
42
|
+
//#region src/utilities/utils.d.ts
|
|
43
43
|
/**
|
|
44
44
|
* * Extracts the hour and minute from a time string in `HH:MM` or `-HH:MM` format.
|
|
45
45
|
*
|
package/dist/utils.mjs
CHANGED
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { l as MS_MAP } from "./basic-DqKyujoj.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { a as isNumericString } from "./utilities-BnHD2hHf.mjs";
|
|
18
|
+
import { c as isNumericString, h as isNumber, m as isNonEmptyString } from "./convert-C8LsoKmI-Blf3eLS6.mjs";
|
|
20
19
|
import { isTimeWithUnit } from "./guards.mjs";
|
|
21
|
-
import { a as formatDate, c as formatUTCOffset, d as getTimeZoneIds, f as getTimestamp, i as extractTimeFromUTC, l as getNativeTimeZoneId, n as extractHourMinute, o as formatDateRelative, p as getTotalMinutes, r as extractMinutesFromUTC, s as formatTimePart, t as convertMinutesToTime, u as getTimeZoneDetails } from "./
|
|
22
|
-
import { t as getGreeting } from "./greet-
|
|
20
|
+
import { a as formatDate, c as formatUTCOffset, d as getTimeZoneIds, f as getTimestamp, i as extractTimeFromUTC, l as getNativeTimeZoneId, n as extractHourMinute, o as formatDateRelative, p as getTotalMinutes, r as extractMinutesFromUTC, s as formatTimePart, t as convertMinutesToTime, u as getTimeZoneDetails } from "./utils-DBy7S7hH.mjs";
|
|
21
|
+
import { t as getGreeting } from "./greet-BC86-X9W.mjs";
|
|
23
22
|
|
|
24
|
-
//#region src/
|
|
23
|
+
//#region src/utilities/parser.ts
|
|
25
24
|
/**
|
|
26
25
|
* * Parse the given value to milliseconds or optionally to seconds.
|
|
27
26
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chronos-date",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A lightweight, immutable, and plugin-based date-time manipulation library for JavaScript and TypeScript.",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"husky": "^9.1.7",
|
|
62
62
|
"lint-staged": "^17.0.5",
|
|
63
63
|
"nhb-scripts": "^1.9.2",
|
|
64
|
-
"
|
|
64
|
+
"toolbox-x": "1.0.1-rc.6",
|
|
65
65
|
"tsdown": "^0.22.0",
|
|
66
66
|
"typescript": "^6.0.3"
|
|
67
67
|
},
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"./package.json": "./package.json"
|
|
150
150
|
},
|
|
151
151
|
"inlinedDependencies": {
|
|
152
|
-
"
|
|
152
|
+
"toolbox-x": "1.0.1-rc.6"
|
|
153
153
|
},
|
|
154
154
|
"scripts": {
|
|
155
155
|
"build": "tsdown",
|
|
@@ -1,49 +0,0 @@
|
|
|
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_primitives = require('./primitives-DfO90c3G.cjs');
|
|
18
|
-
|
|
19
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/basics.js
|
|
20
|
-
function trimString(input) {
|
|
21
|
-
if (!input) return "";
|
|
22
|
-
if (require_primitives.isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
|
|
23
|
-
if (Array.isArray(input)) return input.map((str) => require_primitives.isNonEmptyString(str) ? str.trim().replace(/\s+/g, " ") : str);
|
|
24
|
-
throw new TypeError("Expected string or array of strings!", { cause: "Invalid Input Type" });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/convert.js
|
|
29
|
-
const reverseString = (input) => {
|
|
30
|
-
return trimString(input)?.split("")?.reverse()?.join("");
|
|
31
|
-
};
|
|
32
|
-
function formatUnitWithPlural(count, unit, withNumber = true) {
|
|
33
|
-
const pluralized = Math.abs(count) === 1 ? unit : `${unit}s`;
|
|
34
|
-
return withNumber ? `${count} ${pluralized}` : pluralized;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
Object.defineProperty(exports, 'formatUnitWithPlural', {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return formatUnitWithPlural;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, 'reverseString', {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return reverseString;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
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 isNonEmptyString } from "./primitives-BXhrgs9R.mjs";
|
|
18
|
-
|
|
19
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/basics.js
|
|
20
|
-
function trimString(input) {
|
|
21
|
-
if (!input) return "";
|
|
22
|
-
if (isNonEmptyString(input)) return input.trim().replace(/\s+/g, " ");
|
|
23
|
-
if (Array.isArray(input)) return input.map((str) => isNonEmptyString(str) ? str.trim().replace(/\s+/g, " ") : str);
|
|
24
|
-
throw new TypeError("Expected string or array of strings!", { cause: "Invalid Input Type" });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/string/convert.js
|
|
29
|
-
const reverseString = (input) => {
|
|
30
|
-
return trimString(input)?.split("")?.reverse()?.join("");
|
|
31
|
-
};
|
|
32
|
-
function formatUnitWithPlural(count, unit, withNumber = true) {
|
|
33
|
-
const pluralized = Math.abs(count) === 1 ? unit : `${unit}s`;
|
|
34
|
-
return withNumber ? `${count} ${pluralized}` : pluralized;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
export { reverseString as n, formatUnitWithPlural as t };
|
|
@@ -1,68 +0,0 @@
|
|
|
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/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
19
|
-
function isArray(value) {
|
|
20
|
-
return Array.isArray(value);
|
|
21
|
-
}
|
|
22
|
-
function isValidArray(value) {
|
|
23
|
-
return Array.isArray(value) && value?.length > 0;
|
|
24
|
-
}
|
|
25
|
-
function isObject(value) {
|
|
26
|
-
return value !== null && typeof value === "object" && !isArray(value);
|
|
27
|
-
}
|
|
28
|
-
function isNotEmptyObject(value) {
|
|
29
|
-
return isObject(value) && Object.keys(value)?.length > 0;
|
|
30
|
-
}
|
|
31
|
-
function isObjectWithKeys(value, keys) {
|
|
32
|
-
return isObject(value) && keys?.every((key) => key in value);
|
|
33
|
-
}
|
|
34
|
-
function isFunction(value) {
|
|
35
|
-
return typeof value === "function";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
Object.defineProperty(exports, 'isFunction', {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return isFunction;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(exports, 'isNotEmptyObject', {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function () {
|
|
48
|
-
return isNotEmptyObject;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
Object.defineProperty(exports, 'isObject', {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () {
|
|
54
|
-
return isObject;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(exports, 'isObjectWithKeys', {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function () {
|
|
60
|
-
return isObjectWithKeys;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
Object.defineProperty(exports, 'isValidArray', {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
get: function () {
|
|
66
|
-
return isValidArray;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
18
|
-
function isArray(value) {
|
|
19
|
-
return Array.isArray(value);
|
|
20
|
-
}
|
|
21
|
-
function isValidArray(value) {
|
|
22
|
-
return Array.isArray(value) && value?.length > 0;
|
|
23
|
-
}
|
|
24
|
-
function isObject(value) {
|
|
25
|
-
return value !== null && typeof value === "object" && !isArray(value);
|
|
26
|
-
}
|
|
27
|
-
function isNotEmptyObject(value) {
|
|
28
|
-
return isObject(value) && Object.keys(value)?.length > 0;
|
|
29
|
-
}
|
|
30
|
-
function isObjectWithKeys(value, keys) {
|
|
31
|
-
return isObject(value) && keys?.every((key) => key in value);
|
|
32
|
-
}
|
|
33
|
-
function isFunction(value) {
|
|
34
|
-
return typeof value === "function";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
export { isValidArray as a, isObjectWithKeys as i, isNotEmptyObject as n, isObject as r, isFunction as t };
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
18
|
-
function isNumber(value) {
|
|
19
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
20
|
-
}
|
|
21
|
-
function isString(value) {
|
|
22
|
-
return typeof value === "string";
|
|
23
|
-
}
|
|
24
|
-
function isBoolean(value) {
|
|
25
|
-
return typeof value === "boolean";
|
|
26
|
-
}
|
|
27
|
-
function isUndefined(value) {
|
|
28
|
-
return value === void 0;
|
|
29
|
-
}
|
|
30
|
-
function isNonEmptyString(value) {
|
|
31
|
-
return isString(value) && value?.length > 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { isUndefined as a, isString as i, isNonEmptyString as n, isNumber as r, isBoolean as t };
|
|
@@ -1,65 +0,0 @@
|
|
|
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/nhb-toolbox@4.30.14/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
19
|
-
function isNumber(value) {
|
|
20
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
21
|
-
}
|
|
22
|
-
function isString(value) {
|
|
23
|
-
return typeof value === "string";
|
|
24
|
-
}
|
|
25
|
-
function isBoolean(value) {
|
|
26
|
-
return typeof value === "boolean";
|
|
27
|
-
}
|
|
28
|
-
function isUndefined(value) {
|
|
29
|
-
return value === void 0;
|
|
30
|
-
}
|
|
31
|
-
function isNonEmptyString(value) {
|
|
32
|
-
return isString(value) && value?.length > 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
Object.defineProperty(exports, 'isBoolean', {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return isBoolean;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, 'isNonEmptyString', {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return isNonEmptyString;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, 'isNumber', {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return isNumber;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, 'isString', {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return isString;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, 'isUndefined', {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return isUndefined;
|
|
64
|
-
}
|
|
65
|
-
});
|