inferred-types 0.55.14 → 0.55.16
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/modules/inferred-types/dist/index.cjs +127 -23
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +357 -50
- package/modules/inferred-types/dist/index.js +124 -22
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +127 -23
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +202 -33
- package/modules/runtime/dist/index.js +124 -22
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.d.ts +155 -17
- package/package.json +1 -1
|
@@ -256,6 +256,7 @@ __export(index_exports, {
|
|
|
256
256
|
isMassUom: () => isMassUom,
|
|
257
257
|
isMastercard: () => isMastercard,
|
|
258
258
|
isMetric: () => isMetric,
|
|
259
|
+
isMetricCategory: () => isMetricCategory,
|
|
259
260
|
isMexicanNewsUrl: () => isMexicanNewsUrl,
|
|
260
261
|
isMoment: () => isMoment,
|
|
261
262
|
isNarrowableObject: () => isNarrowableObject,
|
|
@@ -287,7 +288,7 @@ __export(index_exports, {
|
|
|
287
288
|
isRegExp: () => isRegExp,
|
|
288
289
|
isRepoSource: () => isRepoSource,
|
|
289
290
|
isRepoUrl: () => isRepoUrl,
|
|
290
|
-
|
|
291
|
+
isResistanceMetric: () => isResistanceMetric,
|
|
291
292
|
isResistanceUom: () => isResistanceUom,
|
|
292
293
|
isRetailUrl: () => isRetailUrl,
|
|
293
294
|
isSameTypeOf: () => isSameTypeOf,
|
|
@@ -352,6 +353,7 @@ __export(index_exports, {
|
|
|
352
353
|
isUndefined: () => isUndefined,
|
|
353
354
|
isUnset: () => isUnset,
|
|
354
355
|
isUom: () => isUom,
|
|
356
|
+
isUomCategory: () => isUomCategory,
|
|
355
357
|
isUri: () => isUri,
|
|
356
358
|
isUrl: () => isUrl,
|
|
357
359
|
isUrlPath: () => isUrlPath,
|
|
@@ -3835,8 +3837,13 @@ function endsWith(endingIn2) {
|
|
|
3835
3837
|
}
|
|
3836
3838
|
|
|
3837
3839
|
// src/type-guards/higher-order/isEqual.ts
|
|
3838
|
-
function
|
|
3839
|
-
return (value) =>
|
|
3840
|
+
function compare(base) {
|
|
3841
|
+
return (value) => {
|
|
3842
|
+
return base.includes(value);
|
|
3843
|
+
};
|
|
3844
|
+
}
|
|
3845
|
+
function isEqual(...base) {
|
|
3846
|
+
return compare(base);
|
|
3840
3847
|
}
|
|
3841
3848
|
|
|
3842
3849
|
// src/type-guards/higher-order/isLength.ts
|
|
@@ -3846,8 +3853,8 @@ function isLength(value, len) {
|
|
|
3846
3853
|
|
|
3847
3854
|
// src/type-guards/higher-order/isSameTypeOf.ts
|
|
3848
3855
|
function isSameTypeOf(base) {
|
|
3849
|
-
return (
|
|
3850
|
-
return typeof base === typeof
|
|
3856
|
+
return (compare2) => {
|
|
3857
|
+
return typeof base === typeof compare2;
|
|
3851
3858
|
};
|
|
3852
3859
|
}
|
|
3853
3860
|
|
|
@@ -4184,58 +4191,107 @@ function isVariable(val) {
|
|
|
4184
4191
|
function separate(s) {
|
|
4185
4192
|
return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR).trim();
|
|
4186
4193
|
}
|
|
4194
|
+
function startsWithNumber(val) {
|
|
4195
|
+
return isString(val) && isNumberLike(val.slice(0, 1));
|
|
4196
|
+
}
|
|
4187
4197
|
function isAreaMetric(val) {
|
|
4188
|
-
return isString(val) && AREA_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4198
|
+
return isString(val) && startsWithNumber(val) && AREA_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4189
4199
|
}
|
|
4190
4200
|
function isLuminosityMetric(val) {
|
|
4191
|
-
return isString(val) && LUMINOSITY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4201
|
+
return isString(val) && startsWithNumber(val) && LUMINOSITY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4192
4202
|
}
|
|
4193
|
-
function
|
|
4194
|
-
return isString(val) && RESISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4203
|
+
function isResistanceMetric(val) {
|
|
4204
|
+
return isString(val) && startsWithNumber(val) && RESISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4195
4205
|
}
|
|
4196
4206
|
function isCurrentMetric(val) {
|
|
4197
|
-
return isString(val) && CURRENT_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4207
|
+
return isString(val) && startsWithNumber(val) && CURRENT_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4198
4208
|
}
|
|
4199
4209
|
function isVoltageMetric(val) {
|
|
4200
|
-
return isString(val) && VOLTAGE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4210
|
+
return isString(val) && startsWithNumber(val) && VOLTAGE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4201
4211
|
}
|
|
4202
4212
|
function isFrequencyMetric(val) {
|
|
4203
|
-
return isString(val) && FREQUENCY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4213
|
+
return isString(val) && startsWithNumber(val) && FREQUENCY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4204
4214
|
}
|
|
4205
4215
|
function isPowerMetric(val) {
|
|
4206
|
-
return isString(val) && POWER_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4216
|
+
return isString(val) && startsWithNumber(val) && POWER_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4207
4217
|
}
|
|
4208
4218
|
function isTimeMetric(val) {
|
|
4209
|
-
return isString(val) && TIME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4219
|
+
return isString(val) && startsWithNumber(val) && TIME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4210
4220
|
}
|
|
4211
4221
|
function isEnergyMetric(val) {
|
|
4212
|
-
return isString(val) && ENERGY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4222
|
+
return isString(val) && startsWithNumber(val) && ENERGY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4213
4223
|
}
|
|
4214
4224
|
function isPressureMetric(val) {
|
|
4215
|
-
return isString(val) && PRESSURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4225
|
+
return isString(val) && startsWithNumber(val) && PRESSURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4216
4226
|
}
|
|
4217
4227
|
function isTemperatureMetric(val) {
|
|
4218
|
-
return isString(val) && TEMPERATURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4228
|
+
return isString(val) && startsWithNumber(val) && TEMPERATURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4219
4229
|
}
|
|
4220
4230
|
function isVolumeMetric(val) {
|
|
4221
|
-
return isString(val) && VOLUME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4231
|
+
return isString(val) && startsWithNumber(val) && VOLUME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4222
4232
|
}
|
|
4223
4233
|
function isAccelerationMetric(val) {
|
|
4224
|
-
return isString(val) && ACCELERATION_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4234
|
+
return isString(val) && startsWithNumber(val) && ACCELERATION_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4225
4235
|
}
|
|
4226
4236
|
function isSpeedMetric(val) {
|
|
4227
4237
|
const speed = SPEED_METRICS_LOOKUP.map((i) => i.abbrev);
|
|
4228
|
-
return isString(val) && speed.includes(separate(val));
|
|
4238
|
+
return isString(val) && startsWithNumber(val) && speed.includes(separate(val));
|
|
4229
4239
|
}
|
|
4230
4240
|
function isMassMetric(val) {
|
|
4231
|
-
return isString(val) && MASS_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4241
|
+
return isString(val) && startsWithNumber(val) && MASS_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4232
4242
|
}
|
|
4233
4243
|
function isDistanceMetric(val) {
|
|
4234
|
-
return isString(val) && DISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4244
|
+
return isString(val) && startsWithNumber(val) && DISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
4235
4245
|
}
|
|
4236
4246
|
function isMetric(val) {
|
|
4237
4247
|
return isDistanceMetric(val) || isMassMetric(val) || isSpeedMetric(val) || isAccelerationMetric(val) || isVoltageMetric(val) || isTemperatureMetric(val) || isPressureMetric(val) || isEnergyMetric(val) || isTimeMetric(val) || isPowerMetric(val) || isFrequencyMetric(val) || isVoltageMetric(val) || isCurrentMetric(val) || isLuminosityMetric(val) || isAreaMetric(val);
|
|
4238
4248
|
}
|
|
4249
|
+
function getCategories(c) {
|
|
4250
|
+
return c.map(
|
|
4251
|
+
(i) => {
|
|
4252
|
+
switch (i) {
|
|
4253
|
+
case "Acceleration":
|
|
4254
|
+
return isAccelerationMetric;
|
|
4255
|
+
case "Area":
|
|
4256
|
+
return isAreaMetric;
|
|
4257
|
+
case "Current":
|
|
4258
|
+
return isCurrentMetric;
|
|
4259
|
+
case "Distance":
|
|
4260
|
+
return isDistanceMetric;
|
|
4261
|
+
case "Frequency":
|
|
4262
|
+
return isFrequencyMetric;
|
|
4263
|
+
case "Luminosity":
|
|
4264
|
+
return isLuminosityMetric;
|
|
4265
|
+
case "Mass":
|
|
4266
|
+
return isMassMetric;
|
|
4267
|
+
case "Power":
|
|
4268
|
+
return isPowerMetric;
|
|
4269
|
+
case "Pressure":
|
|
4270
|
+
return isPressureMetric;
|
|
4271
|
+
case "Resistance":
|
|
4272
|
+
return isResistanceMetric;
|
|
4273
|
+
case "Speed":
|
|
4274
|
+
return isSpeedMetric;
|
|
4275
|
+
case "Temperature":
|
|
4276
|
+
return isTemperatureMetric;
|
|
4277
|
+
case "Time":
|
|
4278
|
+
return isTimeMetric;
|
|
4279
|
+
case "Voltage":
|
|
4280
|
+
return isVoltageMetric;
|
|
4281
|
+
case "Volume":
|
|
4282
|
+
return isVoltageMetric;
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
);
|
|
4286
|
+
}
|
|
4287
|
+
function isMetricCategory(...categories) {
|
|
4288
|
+
const fn2 = (val) => {
|
|
4289
|
+
const tests = getCategories(categories);
|
|
4290
|
+
return tests.some((i) => i(val));
|
|
4291
|
+
};
|
|
4292
|
+
const props = { categories, kind: "MetricTypeGuard" };
|
|
4293
|
+
return createFnWithProps(fn2, props);
|
|
4294
|
+
}
|
|
4239
4295
|
|
|
4240
4296
|
// src/type-guards/metrics/isUom.ts
|
|
4241
4297
|
function isAreaUom(val) {
|
|
@@ -4289,6 +4345,52 @@ function isDistanceUom(val) {
|
|
|
4289
4345
|
function isUom(val) {
|
|
4290
4346
|
return isDistanceUom(val) || isMassUom(val) || isSpeedUom(val) || isAccelerationUom(val) || isVoltageUom(val) || isTemperatureUom(val) || isPressureUom(val) || isEnergyUom(val) || isTimeUom(val) || isPowerUom(val) || isFrequencyUom(val) || isVoltageUom(val) || isCurrentUom(val) || isLuminosityUom(val) || isAreaUom(val);
|
|
4291
4347
|
}
|
|
4348
|
+
function getCategories2(c) {
|
|
4349
|
+
return c.map(
|
|
4350
|
+
(i) => {
|
|
4351
|
+
switch (i) {
|
|
4352
|
+
case "Acceleration":
|
|
4353
|
+
return isAccelerationUom;
|
|
4354
|
+
case "Area":
|
|
4355
|
+
return isAreaUom;
|
|
4356
|
+
case "Current":
|
|
4357
|
+
return isCurrentUom;
|
|
4358
|
+
case "Distance":
|
|
4359
|
+
return isDistanceUom;
|
|
4360
|
+
case "Frequency":
|
|
4361
|
+
return isFrequencyUom;
|
|
4362
|
+
case "Luminosity":
|
|
4363
|
+
return isLuminosityUom;
|
|
4364
|
+
case "Mass":
|
|
4365
|
+
return isMassUom;
|
|
4366
|
+
case "Power":
|
|
4367
|
+
return isPowerUom;
|
|
4368
|
+
case "Pressure":
|
|
4369
|
+
return isPressureUom;
|
|
4370
|
+
case "Resistance":
|
|
4371
|
+
return isResistanceUom;
|
|
4372
|
+
case "Speed":
|
|
4373
|
+
return isSpeedUom;
|
|
4374
|
+
case "Temperature":
|
|
4375
|
+
return isTemperatureUom;
|
|
4376
|
+
case "Time":
|
|
4377
|
+
return isTimeUom;
|
|
4378
|
+
case "Voltage":
|
|
4379
|
+
return isVoltageUom;
|
|
4380
|
+
case "Volume":
|
|
4381
|
+
return isVoltageUom;
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
);
|
|
4385
|
+
}
|
|
4386
|
+
function isUomCategory(...categories) {
|
|
4387
|
+
const fn2 = (val) => {
|
|
4388
|
+
const tests = getCategories2(categories);
|
|
4389
|
+
return tests.some((i) => i(val));
|
|
4390
|
+
};
|
|
4391
|
+
const prop = { categories, kind: "UomTypeGuard" };
|
|
4392
|
+
return createFnWithProps(fn2, prop);
|
|
4393
|
+
}
|
|
4292
4394
|
|
|
4293
4395
|
// src/type-guards/network-tg.ts
|
|
4294
4396
|
function isIp4Address(val) {
|
|
@@ -6398,6 +6500,7 @@ function asVueRef(value) {
|
|
|
6398
6500
|
isMassUom,
|
|
6399
6501
|
isMastercard,
|
|
6400
6502
|
isMetric,
|
|
6503
|
+
isMetricCategory,
|
|
6401
6504
|
isMexicanNewsUrl,
|
|
6402
6505
|
isMoment,
|
|
6403
6506
|
isNarrowableObject,
|
|
@@ -6429,7 +6532,7 @@ function asVueRef(value) {
|
|
|
6429
6532
|
isRegExp,
|
|
6430
6533
|
isRepoSource,
|
|
6431
6534
|
isRepoUrl,
|
|
6432
|
-
|
|
6535
|
+
isResistanceMetric,
|
|
6433
6536
|
isResistanceUom,
|
|
6434
6537
|
isRetailUrl,
|
|
6435
6538
|
isSameTypeOf,
|
|
@@ -6494,6 +6597,7 @@ function asVueRef(value) {
|
|
|
6494
6597
|
isUndefined,
|
|
6495
6598
|
isUnset,
|
|
6496
6599
|
isUom,
|
|
6600
|
+
isUomCategory,
|
|
6497
6601
|
isUri,
|
|
6498
6602
|
isUrl,
|
|
6499
6603
|
isUrlPath,
|