inferred-types 0.51.12 → 0.51.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs +159 -0
- package/dist/index.js +148 -0
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/datetime/getToday.d.ts +7 -0
- package/dist/runtime/datetime/getToday.d.ts.map +1 -0
- package/dist/runtime/datetime/getToday.js +8 -0
- package/dist/runtime/datetime/getTomorrow.d.ts +8 -0
- package/dist/runtime/datetime/getTomorrow.d.ts.map +1 -0
- package/dist/runtime/datetime/getTomorrow.js +10 -0
- package/dist/runtime/datetime/getYesterday.d.ts +8 -0
- package/dist/runtime/datetime/getYesterday.d.ts.map +1 -0
- package/dist/runtime/datetime/getYesterday.js +10 -0
- package/dist/runtime/datetime/index.d.ts +4 -0
- package/dist/runtime/datetime/index.d.ts.map +1 -0
- package/dist/runtime/datetime/index.js +3 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-guards/date-time/index.d.ts +8 -0
- package/dist/runtime/type-guards/date-time/index.d.ts.map +1 -1
- package/dist/runtime/type-guards/date-time/index.js +8 -0
- package/dist/runtime/type-guards/date-time/isDate.d.ts +5 -0
- package/dist/runtime/type-guards/date-time/isDate.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isDate.js +6 -0
- package/dist/runtime/type-guards/date-time/isLuxonDateTime.d.ts +7 -0
- package/dist/runtime/type-guards/date-time/isLuxonDateTime.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isLuxonDateTime.js +25 -0
- package/dist/runtime/type-guards/date-time/isMoment.d.ts +7 -0
- package/dist/runtime/type-guards/date-time/isMoment.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isMoment.js +25 -0
- package/dist/runtime/type-guards/date-time/isThisMonth.d.ts +9 -0
- package/dist/runtime/type-guards/date-time/isThisMonth.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isThisMonth.js +40 -0
- package/dist/runtime/type-guards/date-time/isThisYear.d.ts +9 -0
- package/dist/runtime/type-guards/date-time/isThisYear.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isThisYear.js +34 -0
- package/dist/runtime/type-guards/date-time/isToday.d.ts +13 -0
- package/dist/runtime/type-guards/date-time/isToday.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isToday.js +25 -0
- package/dist/runtime/type-guards/date-time/isTomorrow.d.ts +12 -0
- package/dist/runtime/type-guards/date-time/isTomorrow.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isTomorrow.js +24 -0
- package/dist/runtime/type-guards/date-time/isYesterday.d.ts +12 -0
- package/dist/runtime/type-guards/date-time/isYesterday.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isYesterday.js +24 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoDate.d.ts +26 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoDate.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoDate.js +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoDateTime.d.ts +9 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoDateTime.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoDateTime.js +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoTime.d.ts +15 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoTime.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsIsoTime.js +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsJsDate.d.ts +9 -0
- package/dist/types/boolean-logic/operators/datetime/IsJsDate.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsJsDate.js +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsLuxonDateTime.d.ts +8 -0
- package/dist/types/boolean-logic/operators/datetime/IsLuxonDateTime.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsLuxonDateTime.js +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsMoment.d.ts +8 -0
- package/dist/types/boolean-logic/operators/datetime/IsMoment.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/IsMoment.js +1 -0
- package/dist/types/boolean-logic/operators/datetime/index.d.ts +7 -0
- package/dist/types/boolean-logic/operators/datetime/index.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/datetime/index.js +6 -0
- package/dist/types/boolean-logic/operators/index.d.ts +1 -0
- package/dist/types/boolean-logic/operators/index.d.ts.map +1 -1
- package/dist/types/boolean-logic/operators/index.js +1 -0
- package/dist/types/literals/date-time-objects.d.ts +718 -0
- package/dist/types/literals/date-time-objects.d.ts.map +1 -0
- package/dist/types/literals/date-time-objects.js +1 -0
- package/dist/types/literals/index.d.ts +1 -0
- package/dist/types/literals/index.d.ts.map +1 -1
- package/dist/types/literals/index.js +1 -0
- package/dist/types/string-literals/DateTime.d.ts +2 -4
- package/dist/types/string-literals/DateTime.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -4168,6 +4168,11 @@ var isNewsUrl = (val) => {
|
|
|
4168
4168
|
return isAustralianNewsUrl(val) || isBelgiumNewsUrl(val) || isCanadianNewsUrl(val) || isDanishNewsUrl(val) || isDutchNewsUrl(val) || isFrenchNewsUrl(val) || isGermanNewsUrl(val) || isIndianNewsUrl(val) || isItalianNewsUrl(val) || isJapaneseNewsUrl(val) || isMexicanNewsUrl(val) || isNorwegianNewsUrl(val) || isSouthKoreanNewsUrl(val) || isSpanishNewsUrl(val) || isSwissNewsUrl(val) || isTurkishNewsUrl(val) || isUkNewsUrl(val) || isUsNewsUrl(val);
|
|
4169
4169
|
};
|
|
4170
4170
|
|
|
4171
|
+
// src/runtime/type-guards/date-time/isDate.ts
|
|
4172
|
+
var isDate = (val) => {
|
|
4173
|
+
return val instanceof Date;
|
|
4174
|
+
};
|
|
4175
|
+
|
|
4171
4176
|
// src/runtime/type-guards/date-time/isDateTime.ts
|
|
4172
4177
|
var isIsoDateTime = (val) => {
|
|
4173
4178
|
if (isString(val)) {
|
|
@@ -4224,6 +4229,118 @@ var isIsoDate = (val) => {
|
|
|
4224
4229
|
}
|
|
4225
4230
|
};
|
|
4226
4231
|
|
|
4232
|
+
// src/runtime/type-guards/date-time/isLuxonDateTime.ts
|
|
4233
|
+
var isLuxonDateTime = (val) => {
|
|
4234
|
+
return isObject(val) && typeof val === "object" && val !== null && "isValid" in val && "invalidReason" in val && "invalidExplanation" in val && "toISO" in val && "toFormat" in val && "toMillis" in val && "year" in val && "month" in val && "day" in val && "hour" in val && "minute" in val && "second" in val && "millisecond" in val && typeof val.isValid === "boolean" && typeof val.toISO === "function";
|
|
4235
|
+
};
|
|
4236
|
+
|
|
4237
|
+
// src/runtime/type-guards/date-time/isMoment.ts
|
|
4238
|
+
var isMoment = (val) => {
|
|
4239
|
+
if (val instanceof Date) {
|
|
4240
|
+
return false;
|
|
4241
|
+
}
|
|
4242
|
+
return isObject(val) && // Check for essential Moment.js methods
|
|
4243
|
+
typeof val.format === "function" && typeof val.year === "function" && typeof val.month === "function" && typeof val.date === "function" && // Check for Moment-specific properties
|
|
4244
|
+
"_isAMomentObject" in val && "_isValid" in val && // Check for essential Moment.js manipulation methods
|
|
4245
|
+
typeof val.add === "function" && typeof val.subtract === "function" && // Additional Moment.js specific methods
|
|
4246
|
+
typeof val.toISOString === "function" && typeof val.isValid === "function";
|
|
4247
|
+
};
|
|
4248
|
+
|
|
4249
|
+
// src/runtime/type-guards/date-time/isToday.ts
|
|
4250
|
+
var isToday = (test) => {
|
|
4251
|
+
if (isString(test)) {
|
|
4252
|
+
const justDate = stripAfter(test, "T");
|
|
4253
|
+
return isIsoExplicitDate(justDate) && justDate === getToday();
|
|
4254
|
+
} else if (isMoment(test) || isDate(test)) {
|
|
4255
|
+
return stripAfter(test.toISOString(), "T") === getToday();
|
|
4256
|
+
} else if (isLuxonDateTime(test)) {
|
|
4257
|
+
return stripAfter(test.toISO(), "T") === getToday();
|
|
4258
|
+
}
|
|
4259
|
+
return false;
|
|
4260
|
+
};
|
|
4261
|
+
|
|
4262
|
+
// src/runtime/type-guards/date-time/isTomorrow.ts
|
|
4263
|
+
var isTomorrow = (test) => {
|
|
4264
|
+
if (isString(test)) {
|
|
4265
|
+
const justDate = stripAfter(test, "T");
|
|
4266
|
+
return isIsoExplicitDate(justDate) && justDate === getTomorrow();
|
|
4267
|
+
} else if (isMoment(test) || isDate(test)) {
|
|
4268
|
+
return stripAfter(test.toISOString(), "T") === getTomorrow();
|
|
4269
|
+
} else if (isLuxonDateTime(test)) {
|
|
4270
|
+
return stripAfter(test.toISO(), "T") === getTomorrow();
|
|
4271
|
+
}
|
|
4272
|
+
return false;
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4275
|
+
// src/runtime/type-guards/date-time/isYesterday.ts
|
|
4276
|
+
var isYesterday = (test) => {
|
|
4277
|
+
if (isString(test)) {
|
|
4278
|
+
const justDate = stripAfter(test, "T");
|
|
4279
|
+
return isIsoExplicitDate(justDate) && justDate === getYesterday();
|
|
4280
|
+
} else if (isMoment(test) || isDate(test)) {
|
|
4281
|
+
return stripAfter(test.toISOString(), "T") === getYesterday();
|
|
4282
|
+
} else if (isLuxonDateTime(test)) {
|
|
4283
|
+
return stripAfter(test.toISO(), "T") === getYesterday();
|
|
4284
|
+
}
|
|
4285
|
+
return false;
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4288
|
+
// src/runtime/type-guards/date-time/isThisYear.ts
|
|
4289
|
+
var isThisYear = (val) => {
|
|
4290
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
4291
|
+
if (val instanceof Date) {
|
|
4292
|
+
return val.getFullYear() === currentYear;
|
|
4293
|
+
}
|
|
4294
|
+
if (isMoment(val)) {
|
|
4295
|
+
return val.year() === currentYear;
|
|
4296
|
+
}
|
|
4297
|
+
if (isLuxonDateTime(val)) {
|
|
4298
|
+
return val.year === currentYear;
|
|
4299
|
+
}
|
|
4300
|
+
if (typeof val === "string") {
|
|
4301
|
+
const isoDateRegex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][01]\d:[0-5]\d))?$/;
|
|
4302
|
+
if (!isoDateRegex.test(val)) {
|
|
4303
|
+
return false;
|
|
4304
|
+
}
|
|
4305
|
+
const yearMatch = val.match(/^(\d{4})/);
|
|
4306
|
+
if (yearMatch) {
|
|
4307
|
+
const year = parseInt(yearMatch[1], 10);
|
|
4308
|
+
return year === currentYear;
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
return false;
|
|
4312
|
+
};
|
|
4313
|
+
|
|
4314
|
+
// src/runtime/type-guards/date-time/isThisMonth.ts
|
|
4315
|
+
var isThisMonth = (val) => {
|
|
4316
|
+
const now = /* @__PURE__ */ new Date();
|
|
4317
|
+
const currentYear = now.getFullYear();
|
|
4318
|
+
const currentMonth = now.getMonth() + 1;
|
|
4319
|
+
if (val instanceof Date) {
|
|
4320
|
+
return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
|
|
4321
|
+
}
|
|
4322
|
+
if (isMoment(val)) {
|
|
4323
|
+
const monthValue = val.month();
|
|
4324
|
+
return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
|
|
4325
|
+
}
|
|
4326
|
+
if (isLuxonDateTime(val)) {
|
|
4327
|
+
return val.year === currentYear && val.month === currentMonth;
|
|
4328
|
+
}
|
|
4329
|
+
if (typeof val === "string") {
|
|
4330
|
+
const isoDateRegex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][01]\d:[0-5]\d))?$/;
|
|
4331
|
+
if (!isoDateRegex.test(val)) {
|
|
4332
|
+
return false;
|
|
4333
|
+
}
|
|
4334
|
+
const dateMatch = val.match(/^(\d{4})-(\d{2})/);
|
|
4335
|
+
if (dateMatch) {
|
|
4336
|
+
const year = parseInt(dateMatch[1], 10);
|
|
4337
|
+
const month = parseInt(dateMatch[2], 10);
|
|
4338
|
+
return year === currentYear && month === currentMonth;
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
return false;
|
|
4342
|
+
};
|
|
4343
|
+
|
|
4227
4344
|
// src/runtime/literals/stripTrailing.ts
|
|
4228
4345
|
function stripTrailing(content, ...strip) {
|
|
4229
4346
|
let output = String(content);
|
|
@@ -5318,6 +5435,26 @@ var asVueRef = (value) => ({
|
|
|
5318
5435
|
value,
|
|
5319
5436
|
_value: null
|
|
5320
5437
|
});
|
|
5438
|
+
|
|
5439
|
+
// src/runtime/datetime/getToday.ts
|
|
5440
|
+
var getToday = () => {
|
|
5441
|
+
const today = /* @__PURE__ */ new Date();
|
|
5442
|
+
return today.toISOString().split("T")[0];
|
|
5443
|
+
};
|
|
5444
|
+
|
|
5445
|
+
// src/runtime/datetime/getTomorrow.ts
|
|
5446
|
+
var getTomorrow = () => {
|
|
5447
|
+
const tomorrow = /* @__PURE__ */ new Date();
|
|
5448
|
+
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
5449
|
+
return tomorrow.toISOString().split("T")[0];
|
|
5450
|
+
};
|
|
5451
|
+
|
|
5452
|
+
// src/runtime/datetime/getYesterday.ts
|
|
5453
|
+
var getYesterday = () => {
|
|
5454
|
+
const yesterday = /* @__PURE__ */ new Date();
|
|
5455
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
5456
|
+
return yesterday.toISOString().split("T")[0];
|
|
5457
|
+
};
|
|
5321
5458
|
export {
|
|
5322
5459
|
ACCELERATION_METRICS_LOOKUP,
|
|
5323
5460
|
ALPHA_CHARS,
|
|
@@ -5552,11 +5689,14 @@ export {
|
|
|
5552
5689
|
get,
|
|
5553
5690
|
getEach,
|
|
5554
5691
|
getPhoneCountryCode,
|
|
5692
|
+
getToday,
|
|
5693
|
+
getTomorrow,
|
|
5555
5694
|
getUrlPath,
|
|
5556
5695
|
getUrlPort,
|
|
5557
5696
|
getUrlProtocol,
|
|
5558
5697
|
getUrlQueryParams,
|
|
5559
5698
|
getUrlSource,
|
|
5699
|
+
getYesterday,
|
|
5560
5700
|
getYouTubePageType,
|
|
5561
5701
|
handleDoneFn,
|
|
5562
5702
|
hasDefaultValue,
|
|
@@ -5629,6 +5769,7 @@ export {
|
|
|
5629
5769
|
isCurrentUom,
|
|
5630
5770
|
isCvsUrl,
|
|
5631
5771
|
isDanishNewsUrl,
|
|
5772
|
+
isDate,
|
|
5632
5773
|
isDefineObject,
|
|
5633
5774
|
isDefined,
|
|
5634
5775
|
isDellUrl,
|
|
@@ -5696,12 +5837,14 @@ export {
|
|
|
5696
5837
|
isLowesUrl,
|
|
5697
5838
|
isLuminosityMetric,
|
|
5698
5839
|
isLuminosityUom,
|
|
5840
|
+
isLuxonDateTime,
|
|
5699
5841
|
isMacysUrl,
|
|
5700
5842
|
isMapToken,
|
|
5701
5843
|
isMassMetric,
|
|
5702
5844
|
isMassUom,
|
|
5703
5845
|
isMetric,
|
|
5704
5846
|
isMexicanNewsUrl,
|
|
5847
|
+
isMoment,
|
|
5705
5848
|
isNever,
|
|
5706
5849
|
isNewsUrl,
|
|
5707
5850
|
isNikeUrl,
|
|
@@ -5759,8 +5902,12 @@ export {
|
|
|
5759
5902
|
isTemperatureMetric,
|
|
5760
5903
|
isTemperatureUom,
|
|
5761
5904
|
isThenable,
|
|
5905
|
+
isThisMonth,
|
|
5906
|
+
isThisYear,
|
|
5762
5907
|
isTimeMetric,
|
|
5763
5908
|
isTimeUom,
|
|
5909
|
+
isToday,
|
|
5910
|
+
isTomorrow,
|
|
5764
5911
|
isTrimable,
|
|
5765
5912
|
isTrue,
|
|
5766
5913
|
isTruthy,
|
|
@@ -5792,6 +5939,7 @@ export {
|
|
|
5792
5939
|
isWayfairUrl,
|
|
5793
5940
|
isWeakMapToken,
|
|
5794
5941
|
isWholeFoodsUrl,
|
|
5942
|
+
isYesterday,
|
|
5795
5943
|
isYouTubeCreatorUrl,
|
|
5796
5944
|
isYouTubeFeedHistoryUrl,
|
|
5797
5945
|
isYouTubeFeedUrl,
|