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
|
@@ -4553,7 +4553,7 @@ type InvalidNever = Throw<"invalid-never", `The value of T when calling IsWideTy
|
|
|
4553
4553
|
type IsWideType<T, TNever = InvalidNever> = [IsNever<T>] extends [true] ? TNever : [T] extends [ErrorCondition] ? ProxyError<T, "IsWideType"> : IsWideScalar<T> extends true ? true : IsWideContainer<T> extends true ? true : IsWideUnion<T> extends true ? true : false;
|
|
4554
4554
|
|
|
4555
4555
|
type Process$1k<T extends readonly unknown[]> = {
|
|
4556
|
-
[K in keyof T]: IsWideType<T[K]
|
|
4556
|
+
[K in keyof T]: IsWideType<T[K]> extends true ? true : Or<[IsUndefined<T[K]>, IsNull<T[K]>]> extends true ? true : false;
|
|
4557
4557
|
};
|
|
4558
4558
|
/**
|
|
4559
4559
|
* **IsWideUnion**`<T>`
|
|
@@ -8129,6 +8129,160 @@ type FrequencyUom = {
|
|
|
8129
8129
|
*/
|
|
8130
8130
|
type Frequency = `${number}${OptSpace}${FrequencyUom}`;
|
|
8131
8131
|
|
|
8132
|
+
/**
|
|
8133
|
+
* **MetricCategory**
|
|
8134
|
+
*
|
|
8135
|
+
* A valid "category" for a `Metric` or `Uom`.
|
|
8136
|
+
*
|
|
8137
|
+
* **Related:** `Uom`, `Metric`
|
|
8138
|
+
*/
|
|
8139
|
+
type MetricCategory = "Acceleration" | "Area" | "Current" | "Distance" | "Frequency" | "Luminosity" | "Mass" | "Power" | "Pressure" | "Resistance" | "Speed" | "Temperature" | "Time" | "Voltage" | "Volume";
|
|
8140
|
+
type UnitsByCategory<T extends string, M extends readonly [string, string][], R extends string = never> = [] extends M ? R : UnitsByCategory<T, AfterFirst<M>, T extends First<M>[0] ? R | First<M>[1] : R>;
|
|
8141
|
+
/**
|
|
8142
|
+
* **Uom**`<[T]>`
|
|
8143
|
+
*
|
|
8144
|
+
* A _unit of measure_ for a **metric**.
|
|
8145
|
+
*
|
|
8146
|
+
* - you may filter down to only units of a certain category(s) of `MetricCategory`
|
|
8147
|
+
* by adjusting `T`.
|
|
8148
|
+
*
|
|
8149
|
+
* **Related:** `Metric`, `MetricCategory`, `AreaUom`, `SpeedUom`, ...
|
|
8150
|
+
*/
|
|
8151
|
+
type Uom<T extends MetricCategory = MetricCategory> = UnitsByCategory<T, [
|
|
8152
|
+
[
|
|
8153
|
+
"Acceleration",
|
|
8154
|
+
AccelerationUom
|
|
8155
|
+
],
|
|
8156
|
+
[
|
|
8157
|
+
"Area",
|
|
8158
|
+
AreaUom
|
|
8159
|
+
],
|
|
8160
|
+
[
|
|
8161
|
+
"Current",
|
|
8162
|
+
CurrentUom
|
|
8163
|
+
],
|
|
8164
|
+
[
|
|
8165
|
+
"Distance",
|
|
8166
|
+
DistanceUom
|
|
8167
|
+
],
|
|
8168
|
+
[
|
|
8169
|
+
"Frequency",
|
|
8170
|
+
FrequencyUom
|
|
8171
|
+
],
|
|
8172
|
+
[
|
|
8173
|
+
"Luminosity",
|
|
8174
|
+
LuminosityUom
|
|
8175
|
+
],
|
|
8176
|
+
[
|
|
8177
|
+
"Mass",
|
|
8178
|
+
MassUom
|
|
8179
|
+
],
|
|
8180
|
+
[
|
|
8181
|
+
"Power",
|
|
8182
|
+
PowerUom
|
|
8183
|
+
],
|
|
8184
|
+
[
|
|
8185
|
+
"Pressure",
|
|
8186
|
+
PressureUom
|
|
8187
|
+
],
|
|
8188
|
+
[
|
|
8189
|
+
"Resistance",
|
|
8190
|
+
ResistanceUom
|
|
8191
|
+
],
|
|
8192
|
+
[
|
|
8193
|
+
"Speed",
|
|
8194
|
+
SpeedUom
|
|
8195
|
+
],
|
|
8196
|
+
[
|
|
8197
|
+
"Temperature",
|
|
8198
|
+
TemperatureUom
|
|
8199
|
+
],
|
|
8200
|
+
[
|
|
8201
|
+
"Time",
|
|
8202
|
+
TimeUom
|
|
8203
|
+
],
|
|
8204
|
+
[
|
|
8205
|
+
"Volume",
|
|
8206
|
+
VoltageUom
|
|
8207
|
+
],
|
|
8208
|
+
[
|
|
8209
|
+
"Voltage",
|
|
8210
|
+
VolumeUom
|
|
8211
|
+
]
|
|
8212
|
+
]>;
|
|
8213
|
+
/**
|
|
8214
|
+
* **Metric**`<T>`
|
|
8215
|
+
*
|
|
8216
|
+
* A measurement which includes a numeric value plus the Unit of Measure (UOM).
|
|
8217
|
+
*
|
|
8218
|
+
* - you may filter down to only metrics of a certain category(s) of `MetricCategory`
|
|
8219
|
+
* by adjusting `T`.
|
|
8220
|
+
*
|
|
8221
|
+
* **Related:** `Uom`, `MetricCategory`
|
|
8222
|
+
*/
|
|
8223
|
+
type Metric<T extends MetricCategory = MetricCategory> = UnitsByCategory<T, [
|
|
8224
|
+
[
|
|
8225
|
+
"Acceleration",
|
|
8226
|
+
Acceleration
|
|
8227
|
+
],
|
|
8228
|
+
[
|
|
8229
|
+
"Area",
|
|
8230
|
+
Area
|
|
8231
|
+
],
|
|
8232
|
+
[
|
|
8233
|
+
"Current",
|
|
8234
|
+
Current
|
|
8235
|
+
],
|
|
8236
|
+
[
|
|
8237
|
+
"Distance",
|
|
8238
|
+
Distance
|
|
8239
|
+
],
|
|
8240
|
+
[
|
|
8241
|
+
"Frequency",
|
|
8242
|
+
Frequency
|
|
8243
|
+
],
|
|
8244
|
+
[
|
|
8245
|
+
"Luminosity",
|
|
8246
|
+
Luminosity
|
|
8247
|
+
],
|
|
8248
|
+
[
|
|
8249
|
+
"Mass",
|
|
8250
|
+
Mass
|
|
8251
|
+
],
|
|
8252
|
+
[
|
|
8253
|
+
"Power",
|
|
8254
|
+
Power
|
|
8255
|
+
],
|
|
8256
|
+
[
|
|
8257
|
+
"Pressure",
|
|
8258
|
+
Pressure
|
|
8259
|
+
],
|
|
8260
|
+
[
|
|
8261
|
+
"Resistance",
|
|
8262
|
+
Resistance
|
|
8263
|
+
],
|
|
8264
|
+
[
|
|
8265
|
+
"Speed",
|
|
8266
|
+
Speed
|
|
8267
|
+
],
|
|
8268
|
+
[
|
|
8269
|
+
"Temperature",
|
|
8270
|
+
Temperature
|
|
8271
|
+
],
|
|
8272
|
+
[
|
|
8273
|
+
"TimeMetric",
|
|
8274
|
+
TimeMetric
|
|
8275
|
+
],
|
|
8276
|
+
[
|
|
8277
|
+
"Voltage",
|
|
8278
|
+
Voltage
|
|
8279
|
+
],
|
|
8280
|
+
[
|
|
8281
|
+
"Volume",
|
|
8282
|
+
Volume
|
|
8283
|
+
]
|
|
8284
|
+
]>;
|
|
8285
|
+
|
|
8132
8286
|
type LuminosityMetricsLookup = typeof LUMINOSITY_METRICS_LOOKUP;
|
|
8133
8287
|
/**
|
|
8134
8288
|
* Unit of measure for metrics associated with **Luminosity**.
|
|
@@ -8297,22 +8451,6 @@ type VolumeUom = {
|
|
|
8297
8451
|
*/
|
|
8298
8452
|
type Volume = `${number}${OptSpace}${VolumeUom}`;
|
|
8299
8453
|
|
|
8300
|
-
/**
|
|
8301
|
-
* A measurement which includes a numeric value plus the Unit of Measure (UOM).
|
|
8302
|
-
*
|
|
8303
|
-
* **Related:** `Uom`
|
|
8304
|
-
*/
|
|
8305
|
-
type Metric = Acceleration | Area | Current | Distance | Frequency | Luminosity | Mass | Power | Pressure | Resistance | Speed | Temperature | TimeMetric | Voltage | Volume;
|
|
8306
|
-
type MetricCategory = "Acceleration" | "Area" | "Current" | "Distance" | "Frequency" | "Luminosity" | "Mass" | "Power" | "Pressure" | "Resistance" | "Speed" | "Temperature" | "Time" | "Voltage" | "Volume";
|
|
8307
|
-
/**
|
|
8308
|
-
* **Uom**
|
|
8309
|
-
*
|
|
8310
|
-
* A _unit of measure_ for a **metric**.
|
|
8311
|
-
*
|
|
8312
|
-
* **Related:** `Metric`, `AreaUom`, `SpeedUom`,`MassUom`, `DistanceUom`, ...
|
|
8313
|
-
*/
|
|
8314
|
-
type Uom = AccelerationUom | AreaUom | CurrentUom | DistanceUom | FrequencyUom | LuminosityUom | MassUom | PowerUom | PressureUom | ResistanceUom | SpeedUom | TemperatureUom | TimeUom | VoltageUom | VolumeUom;
|
|
8315
|
-
|
|
8316
8454
|
/**
|
|
8317
8455
|
* **TypeRequired**
|
|
8318
8456
|
*
|
|
@@ -12115,7 +12253,7 @@ declare function getYesterday(): Iso8601Date<"explicit">;
|
|
|
12115
12253
|
*/
|
|
12116
12254
|
declare function isLeapYear(val: NumberLike | Record<string, any> | Date | number): boolean;
|
|
12117
12255
|
|
|
12118
|
-
type Returns$
|
|
12256
|
+
type Returns$6<T extends DefineObject, P extends readonly (keyof T & string)[]> = P["length"] extends 0 ? FromDefineObject<T> : MakeKeysOptional<T, P> extends DefineObject ? FromDefineObject<MakeKeysOptional<T, P>> : never;
|
|
12119
12257
|
/**
|
|
12120
12258
|
* Takes an object definition where the values are either
|
|
12121
12259
|
* `SimpleToken` representations of a type or a `ShapeCallback`.
|
|
@@ -12123,7 +12261,7 @@ type Returns$5<T extends DefineObject, P extends readonly (keyof T & string)[]>
|
|
|
12123
12261
|
* In both cases the runtime type is left unchanged but the
|
|
12124
12262
|
* type is converted to represent the designed object shape.
|
|
12125
12263
|
*/
|
|
12126
|
-
declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$
|
|
12264
|
+
declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$6<T, P>;
|
|
12127
12265
|
|
|
12128
12266
|
/**
|
|
12129
12267
|
* **entries**
|
|
@@ -12821,14 +12959,14 @@ type _Index<T extends readonly string[], IF, ELSE, Results extends readonly unkn
|
|
|
12821
12959
|
...Results,
|
|
12822
12960
|
If<Extends<T, LowerAlphaChar>, IF, ELSE>
|
|
12823
12961
|
]>;
|
|
12824
|
-
type Returns$
|
|
12962
|
+
type Returns$5<T extends string | readonly string[], IF, ELSE> = T extends string ? If<Extends<T, LowerAlphaChar>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
|
|
12825
12963
|
/**
|
|
12826
12964
|
* **ifLowercaseChar**(ch)
|
|
12827
12965
|
*
|
|
12828
12966
|
* Tests whether a passed in character is lowercase and then uses the appropriate callback to
|
|
12829
12967
|
* mutate the value.
|
|
12830
12968
|
*/
|
|
12831
|
-
declare function ifLowercaseChar<T extends string, IF, ELSE>(ch: T, callbackForMatch: <V extends T>(v: V) => IF, callbackForNoMatch: <V extends T>(v: V) => ELSE): Returns$
|
|
12969
|
+
declare function ifLowercaseChar<T extends string, IF, ELSE>(ch: T, callbackForMatch: <V extends T>(v: V) => IF, callbackForNoMatch: <V extends T>(v: V) => ELSE): Returns$5<T, IF, ELSE>;
|
|
12832
12970
|
|
|
12833
12971
|
type Convert<T, IF, ELSE> = If<Extends<T, UpperAlphaChar>, IF, ELSE>;
|
|
12834
12972
|
/**
|
|
@@ -12884,7 +13022,7 @@ interface GetInferenceProps<TPattern extends string> {
|
|
|
12884
13022
|
typeWide: WiderTypeLiteral<TPattern>;
|
|
12885
13023
|
}
|
|
12886
13024
|
type GetInference<TPattern extends string> = (<T extends string>(test: T) => T extends TypeLiteral<TPattern> ? Shape<TPattern> : false | Shape<TPattern>) & GetInferenceProps<TPattern>;
|
|
12887
|
-
type Returns$
|
|
13025
|
+
type Returns$4<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
|
|
12888
13026
|
/**
|
|
12889
13027
|
* **infer**`(pattern)`
|
|
12890
13028
|
*
|
|
@@ -12904,7 +13042,7 @@ type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> :
|
|
|
12904
13042
|
* const {foo} = matcher("foo-bar");
|
|
12905
13043
|
* ```
|
|
12906
13044
|
*/
|
|
12907
|
-
declare function infer<TTempl extends string>(inference: TTempl): Returns$
|
|
13045
|
+
declare function infer<TTempl extends string>(inference: TTempl): Returns$4<TTempl>;
|
|
12908
13046
|
|
|
12909
13047
|
/**
|
|
12910
13048
|
* Takes an object as input --which has an `id` property and returns it as the same
|
|
@@ -13144,14 +13282,14 @@ declare function stripBefore<TContent extends string, TBreak extends string>(con
|
|
|
13144
13282
|
*/
|
|
13145
13283
|
declare function stripChars<TContent extends string, TRetain extends readonly string[]>(content: TContent, ...strip: TRetain): StripChars<TContent, TRetain[number]>;
|
|
13146
13284
|
|
|
13147
|
-
type Returns$
|
|
13285
|
+
type Returns$3<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripLeading<T, TupleToUnion<U>> : never;
|
|
13148
13286
|
/**
|
|
13149
13287
|
* **stripLeading**(content, ...strip)
|
|
13150
13288
|
*
|
|
13151
13289
|
* Runtime utility which strips of a leading substring from the
|
|
13152
13290
|
* primary content if it exists and leaves content unchanged otherwise.
|
|
13153
13291
|
*/
|
|
13154
|
-
declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$
|
|
13292
|
+
declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$3<T, U>;
|
|
13155
13293
|
|
|
13156
13294
|
type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TInput extends string | number>(input: TInput) => StripSurround<TInput, TStrip[number]>;
|
|
13157
13295
|
/**
|
|
@@ -13171,14 +13309,14 @@ type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TIn
|
|
|
13171
13309
|
*/
|
|
13172
13310
|
declare function stripSurround<TChars extends readonly (number | string)[]>(...chars: TChars): StripSurroundConfigured<TChars>;
|
|
13173
13311
|
|
|
13174
|
-
type Returns$
|
|
13312
|
+
type Returns$2<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripTrailing<T, TupleToUnion<U>> : never;
|
|
13175
13313
|
/**
|
|
13176
13314
|
* **stripTrailing**(content, strip)
|
|
13177
13315
|
*
|
|
13178
13316
|
* Runtime utility which ensures that last part of a string has substring
|
|
13179
13317
|
* removed if it exists and that strong typing is preserved.
|
|
13180
13318
|
*/
|
|
13181
|
-
declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$
|
|
13319
|
+
declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$2<T, U>;
|
|
13182
13320
|
|
|
13183
13321
|
/**
|
|
13184
13322
|
* **stripUntil**`(content, ...until)`
|
|
@@ -13947,7 +14085,7 @@ interface SortApi<O extends readonly string[]> {
|
|
|
13947
14085
|
done: () => O;
|
|
13948
14086
|
}
|
|
13949
14087
|
type ToKeyValueSort<O extends readonly string[]> = <TCb extends SortApi<O>>(cb: TCb) => unknown;
|
|
13950
|
-
type Returns<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefined> = S extends undefined ? ToKv<T> : S extends ToKeyValueSort<SKeys<T>> ? HandleDoneFn<ReturnType<S>> extends readonly (keyof T & string)[] ? ToKv<T, HandleDoneFn<ReturnType<S>>> : never : never;
|
|
14088
|
+
type Returns$1<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefined> = S extends undefined ? ToKv<T> : S extends ToKeyValueSort<SKeys<T>> ? HandleDoneFn<ReturnType<S>> extends readonly (keyof T & string)[] ? ToKv<T, HandleDoneFn<ReturnType<S>>> : never : never;
|
|
13951
14089
|
/**
|
|
13952
14090
|
* **toKeyValue**`(obj)` -> tuple
|
|
13953
14091
|
*
|
|
@@ -13971,7 +14109,7 @@ type Returns<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefined
|
|
|
13971
14109
|
*/
|
|
13972
14110
|
declare function toKeyValue<T extends {
|
|
13973
14111
|
[key: string]: N;
|
|
13974
|
-
}, N extends Narrowable, S extends ToKeyValueSort<SKeys<T>> | undefined>(obj: T, sort?: S): Returns<T, S>;
|
|
14112
|
+
}, N extends Narrowable, S extends ToKeyValueSort<SKeys<T>> | undefined>(obj: T, sort?: S): Returns$1<T, S>;
|
|
13975
14113
|
|
|
13976
14114
|
/**
|
|
13977
14115
|
* **toNumber**(value)
|
|
@@ -14316,13 +14454,14 @@ declare function endsWith<T extends string>(endingIn: T): EndingWithTypeGuard<T>
|
|
|
14316
14454
|
/**
|
|
14317
14455
|
* A TypeGuard which was generated from `isEqual()` runtime util.
|
|
14318
14456
|
*/
|
|
14319
|
-
type EqualTo<
|
|
14457
|
+
type EqualTo<_A> = <TValue extends Narrowable>(value: TValue) => boolean;
|
|
14458
|
+
type Returns<TVal, TBase extends readonly Narrowable[]> = IsUnion<TVal> extends true ? TVal & TBase[number] : TVal extends TBase[number] ? TVal : IsUnion<TVal> extends true ? TVal : never;
|
|
14320
14459
|
/**
|
|
14321
14460
|
* **isEqual**(compareTo)(value)
|
|
14322
14461
|
*
|
|
14323
14462
|
* Higher order type guard to detect whether two values are equal
|
|
14324
14463
|
*/
|
|
14325
|
-
declare function isEqual<TBase extends Narrowable>(base: TBase):
|
|
14464
|
+
declare function isEqual<TBase extends readonly N[], N extends Narrowable>(...base: TBase): <TVal extends Narrowable>(value: TVal) => value is Returns<TVal, TBase>;
|
|
14326
14465
|
|
|
14327
14466
|
/**
|
|
14328
14467
|
* **ifLength**(len) => (value) => boolean
|
|
@@ -14848,7 +14987,7 @@ declare function isVariable(val: unknown): val is Variable;
|
|
|
14848
14987
|
|
|
14849
14988
|
declare function isAreaMetric(val: unknown): val is Area;
|
|
14850
14989
|
declare function isLuminosityMetric(val: unknown): val is Luminosity;
|
|
14851
|
-
declare function
|
|
14990
|
+
declare function isResistanceMetric(val: unknown): val is Resistance;
|
|
14852
14991
|
declare function isCurrentMetric(val: unknown): val is Current;
|
|
14853
14992
|
declare function isVoltageMetric(val: unknown): val is Voltage;
|
|
14854
14993
|
declare function isFrequencyMetric(val: unknown): val is Frequency;
|
|
@@ -14867,6 +15006,19 @@ declare function isDistanceMetric(val: unknown): val is Distance;
|
|
|
14867
15006
|
* of measure).
|
|
14868
15007
|
*/
|
|
14869
15008
|
declare function isMetric(val: unknown): val is Metric;
|
|
15009
|
+
type MetricTypeGuard<TCat extends readonly MetricCategory[]> = ((val: unknown) => boolean) & {
|
|
15010
|
+
categories: TCat;
|
|
15011
|
+
kind: "MetricTypeGuard";
|
|
15012
|
+
};
|
|
15013
|
+
/**
|
|
15014
|
+
* **isMetricCategory**`(...categories) => (val) => val is Uom<T>`
|
|
15015
|
+
*
|
|
15016
|
+
* A higher order type guard which validates that a value is a metric
|
|
15017
|
+
* with the specified category(s) UOM's.
|
|
15018
|
+
*
|
|
15019
|
+
* **Related:** `isMetric()`, `isAreaMetric()`, `isSpeedMetric()`, ...
|
|
15020
|
+
*/
|
|
15021
|
+
declare function isMetricCategory<TCat extends readonly [MetricCategory, ...MetricCategory[]]>(...categories: TCat): MetricTypeGuard<TCat>;
|
|
14870
15022
|
|
|
14871
15023
|
declare function isAreaUom(val: unknown): val is AreaUom;
|
|
14872
15024
|
declare function isLuminosityUom(val: unknown): val is LuminosityUom;
|
|
@@ -14887,8 +15039,25 @@ declare function isDistanceUom(val: unknown): val is DistanceUom;
|
|
|
14887
15039
|
/**
|
|
14888
15040
|
* Type guard which validates the passed in `val` is a `Uom` (unit
|
|
14889
15041
|
* of measure).
|
|
15042
|
+
*
|
|
15043
|
+
* **Related:**
|
|
15044
|
+
* - `isUomCategory(c)(v)`
|
|
15045
|
+
* - `isSpeedUom(v)`, `isMassUom(v)`, ...
|
|
14890
15046
|
*/
|
|
14891
15047
|
declare function isUom(val: unknown): val is Uom;
|
|
15048
|
+
type UomTypeGuard<TCat extends readonly MetricCategory[]> = ((val: unknown) => boolean) & {
|
|
15049
|
+
categories: TCat;
|
|
15050
|
+
kind: "UomTypeGuard";
|
|
15051
|
+
};
|
|
15052
|
+
/**
|
|
15053
|
+
* **isUomCategory**`(...categories) => (val) => val is Uom<T>`
|
|
15054
|
+
*
|
|
15055
|
+
* A higher order type guard which validates that a value is of
|
|
15056
|
+
* the specified metric category or categories.
|
|
15057
|
+
*
|
|
15058
|
+
* **Related:** `isUom()`, `isAreaUom()`, `isSpeedUom()`, ...
|
|
15059
|
+
*/
|
|
15060
|
+
declare function isUomCategory<TCat extends readonly [MetricCategory, ...MetricCategory[]]>(...categories: TCat): UomTypeGuard<TCat>;
|
|
14892
15061
|
|
|
14893
15062
|
/**
|
|
14894
15063
|
* **isIp4Address**`(val)`
|
|
@@ -15636,4 +15805,4 @@ declare function isVueRef(val: unknown): val is VueRef;
|
|
|
15636
15805
|
*/
|
|
15637
15806
|
declare function asVueRef<T extends Narrowable>(value: T): VueRef<T>;
|
|
15638
15807
|
|
|
15639
|
-
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type ConfigRestApi, type CssFromDefnOption, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type DictionaryWithValueFilter, type DictionaryWithoutValueFilter, type DoesExtendTypeguard, type EndingWithTypeGuard, type EndpointGenerator, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetInferenceProps, type GetOptions, type Joiner, type KeyframeApi, type Mapper, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type ToKeyValueSort, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, cardType, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createMapper, createObjectMap, createTypeToken, cssColor, cssFromDefinition, csv, defineCss, defineObj, defineObject, defineObjectApi, defineTuple, doesExtend, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, filterEmpty, filterUndefined, find, fnMeta, fromDefineObject, fromKeyValue, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getTypeSubtype, getUrlBase, getUrlDefaultPort, getUrlDynamics, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasCountryCode, hasDefaultValue, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isAmericanExpress, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCreditCard, isCssAspectRatio, isCsv, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEmpty, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMap, isMapToken, isMassMetric, isMassUom, isMastercard, isMetric, isMexicanNewsUrl, isMoment, isNarrowableObject, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotEmpty, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl,
|
|
15808
|
+
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type ConfigRestApi, type CssFromDefnOption, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type DictionaryWithValueFilter, type DictionaryWithoutValueFilter, type DoesExtendTypeguard, type EndingWithTypeGuard, type EndpointGenerator, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetInferenceProps, type GetOptions, type Joiner, type KeyframeApi, type Mapper, type MetricTypeGuard, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type ToKeyValueSort, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UomTypeGuard, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, cardType, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createMapper, createObjectMap, createTypeToken, cssColor, cssFromDefinition, csv, defineCss, defineObj, defineObject, defineObjectApi, defineTuple, doesExtend, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, filterEmpty, filterUndefined, find, fnMeta, fromDefineObject, fromKeyValue, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getTypeSubtype, getUrlBase, getUrlDefaultPort, getUrlDynamics, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasCountryCode, hasDefaultValue, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isAmericanExpress, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCreditCard, isCssAspectRatio, isCsv, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEmpty, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMap, isMapToken, isMassMetric, isMassUom, isMastercard, isMetric, isMetricCategory, isMexicanNewsUrl, isMoment, isNarrowableObject, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotEmpty, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistanceMetric, isResistanceUom, isRetailUrl, isSameTypeOf, isScalar, isSemanticVersion, isSet, isSetBasedKind, isSetBasedToken, isSetContainer, isSetToken, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSingletonKind, isSingletonToken, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isString, isStringArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTargetUrl, isTemperatureMetric, isTemperatureUom, isThenable, isThisMonth, isThisWeek, isThisYear, isTimeMetric, isTimeUom, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTupleToken, isTurkishNewsUrl, isTypeOf, isTypeSubtype, isTypeToken, isTypeTokenKind, isTypeTuple, isUkNewsUrl, isUndefined, isUnset, isUom, isUomCategory, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsPhoneNumber, isUsStateAbbreviation, isUsStateName, isVariable, isVisa, isVisaMastercard, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isVueRef, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, jsonValue, jsonValues, keysOf, kindLiteral, last, list, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, maybePhoneNumber, mergeObjects, mergeScalars, mergeTuples, nameLiteral, narrow, narrowObjectTo, narrowObjectToType, never, objectToApi, objectValues, omit, optional, optionalOrNull, or, orNull, pathJoin, pluralize, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, result, retain, retainAfter, retainAfterInclusive, retainChars, retainUntil, retainUntilInclusive, retainWhile, reverse, rightWhitespace, shape, sharedKeys, shift, simpleContainerToken, simpleContainerTokenToTypeToken, simpleContainerType, simpleScalarToken, simpleScalarTokenToTypeToken, simpleScalarType, simpleToken, simpleType, simpleUnionTokenToTypeToken, slice, split, startsWith, stripAfter, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, takeNumericCharacters, takeProp, toCamelCase, toKebabCase, toKeyValue, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toUppercase, trim, trimEnd, trimLeft, trimRight, trimStart, truncate, tuple, twColor, unbox, uncapitalize, union, unionize, unique, uniqueKeys, unset, uppercase, urlMeta, valuesOf, widen, withDefaults, withKeys, withValue, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
|
|
@@ -3334,8 +3334,13 @@ function endsWith(endingIn2) {
|
|
|
3334
3334
|
}
|
|
3335
3335
|
|
|
3336
3336
|
// src/type-guards/higher-order/isEqual.ts
|
|
3337
|
-
function
|
|
3338
|
-
return (value) =>
|
|
3337
|
+
function compare(base) {
|
|
3338
|
+
return (value) => {
|
|
3339
|
+
return base.includes(value);
|
|
3340
|
+
};
|
|
3341
|
+
}
|
|
3342
|
+
function isEqual(...base) {
|
|
3343
|
+
return compare(base);
|
|
3339
3344
|
}
|
|
3340
3345
|
|
|
3341
3346
|
// src/type-guards/higher-order/isLength.ts
|
|
@@ -3345,8 +3350,8 @@ function isLength(value, len) {
|
|
|
3345
3350
|
|
|
3346
3351
|
// src/type-guards/higher-order/isSameTypeOf.ts
|
|
3347
3352
|
function isSameTypeOf(base) {
|
|
3348
|
-
return (
|
|
3349
|
-
return typeof base === typeof
|
|
3353
|
+
return (compare2) => {
|
|
3354
|
+
return typeof base === typeof compare2;
|
|
3350
3355
|
};
|
|
3351
3356
|
}
|
|
3352
3357
|
|
|
@@ -3683,58 +3688,107 @@ function isVariable(val) {
|
|
|
3683
3688
|
function separate(s) {
|
|
3684
3689
|
return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR).trim();
|
|
3685
3690
|
}
|
|
3691
|
+
function startsWithNumber(val) {
|
|
3692
|
+
return isString(val) && isNumberLike(val.slice(0, 1));
|
|
3693
|
+
}
|
|
3686
3694
|
function isAreaMetric(val) {
|
|
3687
|
-
return isString(val) && AREA_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3695
|
+
return isString(val) && startsWithNumber(val) && AREA_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3688
3696
|
}
|
|
3689
3697
|
function isLuminosityMetric(val) {
|
|
3690
|
-
return isString(val) && LUMINOSITY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3698
|
+
return isString(val) && startsWithNumber(val) && LUMINOSITY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3691
3699
|
}
|
|
3692
|
-
function
|
|
3693
|
-
return isString(val) && RESISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3700
|
+
function isResistanceMetric(val) {
|
|
3701
|
+
return isString(val) && startsWithNumber(val) && RESISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3694
3702
|
}
|
|
3695
3703
|
function isCurrentMetric(val) {
|
|
3696
|
-
return isString(val) && CURRENT_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3704
|
+
return isString(val) && startsWithNumber(val) && CURRENT_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3697
3705
|
}
|
|
3698
3706
|
function isVoltageMetric(val) {
|
|
3699
|
-
return isString(val) && VOLTAGE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3707
|
+
return isString(val) && startsWithNumber(val) && VOLTAGE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3700
3708
|
}
|
|
3701
3709
|
function isFrequencyMetric(val) {
|
|
3702
|
-
return isString(val) && FREQUENCY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3710
|
+
return isString(val) && startsWithNumber(val) && FREQUENCY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3703
3711
|
}
|
|
3704
3712
|
function isPowerMetric(val) {
|
|
3705
|
-
return isString(val) && POWER_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3713
|
+
return isString(val) && startsWithNumber(val) && POWER_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3706
3714
|
}
|
|
3707
3715
|
function isTimeMetric(val) {
|
|
3708
|
-
return isString(val) && TIME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3716
|
+
return isString(val) && startsWithNumber(val) && TIME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3709
3717
|
}
|
|
3710
3718
|
function isEnergyMetric(val) {
|
|
3711
|
-
return isString(val) && ENERGY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3719
|
+
return isString(val) && startsWithNumber(val) && ENERGY_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3712
3720
|
}
|
|
3713
3721
|
function isPressureMetric(val) {
|
|
3714
|
-
return isString(val) && PRESSURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3722
|
+
return isString(val) && startsWithNumber(val) && PRESSURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3715
3723
|
}
|
|
3716
3724
|
function isTemperatureMetric(val) {
|
|
3717
|
-
return isString(val) && TEMPERATURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3725
|
+
return isString(val) && startsWithNumber(val) && TEMPERATURE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3718
3726
|
}
|
|
3719
3727
|
function isVolumeMetric(val) {
|
|
3720
|
-
return isString(val) && VOLUME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3728
|
+
return isString(val) && startsWithNumber(val) && VOLUME_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3721
3729
|
}
|
|
3722
3730
|
function isAccelerationMetric(val) {
|
|
3723
|
-
return isString(val) && ACCELERATION_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3731
|
+
return isString(val) && startsWithNumber(val) && ACCELERATION_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3724
3732
|
}
|
|
3725
3733
|
function isSpeedMetric(val) {
|
|
3726
3734
|
const speed = SPEED_METRICS_LOOKUP.map((i) => i.abbrev);
|
|
3727
|
-
return isString(val) && speed.includes(separate(val));
|
|
3735
|
+
return isString(val) && startsWithNumber(val) && speed.includes(separate(val));
|
|
3728
3736
|
}
|
|
3729
3737
|
function isMassMetric(val) {
|
|
3730
|
-
return isString(val) && MASS_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3738
|
+
return isString(val) && startsWithNumber(val) && MASS_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3731
3739
|
}
|
|
3732
3740
|
function isDistanceMetric(val) {
|
|
3733
|
-
return isString(val) && DISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3741
|
+
return isString(val) && startsWithNumber(val) && DISTANCE_METRICS_LOOKUP.map((i) => i.abbrev).includes(separate(val));
|
|
3734
3742
|
}
|
|
3735
3743
|
function isMetric(val) {
|
|
3736
3744
|
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);
|
|
3737
3745
|
}
|
|
3746
|
+
function getCategories(c) {
|
|
3747
|
+
return c.map(
|
|
3748
|
+
(i) => {
|
|
3749
|
+
switch (i) {
|
|
3750
|
+
case "Acceleration":
|
|
3751
|
+
return isAccelerationMetric;
|
|
3752
|
+
case "Area":
|
|
3753
|
+
return isAreaMetric;
|
|
3754
|
+
case "Current":
|
|
3755
|
+
return isCurrentMetric;
|
|
3756
|
+
case "Distance":
|
|
3757
|
+
return isDistanceMetric;
|
|
3758
|
+
case "Frequency":
|
|
3759
|
+
return isFrequencyMetric;
|
|
3760
|
+
case "Luminosity":
|
|
3761
|
+
return isLuminosityMetric;
|
|
3762
|
+
case "Mass":
|
|
3763
|
+
return isMassMetric;
|
|
3764
|
+
case "Power":
|
|
3765
|
+
return isPowerMetric;
|
|
3766
|
+
case "Pressure":
|
|
3767
|
+
return isPressureMetric;
|
|
3768
|
+
case "Resistance":
|
|
3769
|
+
return isResistanceMetric;
|
|
3770
|
+
case "Speed":
|
|
3771
|
+
return isSpeedMetric;
|
|
3772
|
+
case "Temperature":
|
|
3773
|
+
return isTemperatureMetric;
|
|
3774
|
+
case "Time":
|
|
3775
|
+
return isTimeMetric;
|
|
3776
|
+
case "Voltage":
|
|
3777
|
+
return isVoltageMetric;
|
|
3778
|
+
case "Volume":
|
|
3779
|
+
return isVoltageMetric;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
);
|
|
3783
|
+
}
|
|
3784
|
+
function isMetricCategory(...categories) {
|
|
3785
|
+
const fn2 = (val) => {
|
|
3786
|
+
const tests = getCategories(categories);
|
|
3787
|
+
return tests.some((i) => i(val));
|
|
3788
|
+
};
|
|
3789
|
+
const props = { categories, kind: "MetricTypeGuard" };
|
|
3790
|
+
return createFnWithProps(fn2, props);
|
|
3791
|
+
}
|
|
3738
3792
|
|
|
3739
3793
|
// src/type-guards/metrics/isUom.ts
|
|
3740
3794
|
function isAreaUom(val) {
|
|
@@ -3788,6 +3842,52 @@ function isDistanceUom(val) {
|
|
|
3788
3842
|
function isUom(val) {
|
|
3789
3843
|
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);
|
|
3790
3844
|
}
|
|
3845
|
+
function getCategories2(c) {
|
|
3846
|
+
return c.map(
|
|
3847
|
+
(i) => {
|
|
3848
|
+
switch (i) {
|
|
3849
|
+
case "Acceleration":
|
|
3850
|
+
return isAccelerationUom;
|
|
3851
|
+
case "Area":
|
|
3852
|
+
return isAreaUom;
|
|
3853
|
+
case "Current":
|
|
3854
|
+
return isCurrentUom;
|
|
3855
|
+
case "Distance":
|
|
3856
|
+
return isDistanceUom;
|
|
3857
|
+
case "Frequency":
|
|
3858
|
+
return isFrequencyUom;
|
|
3859
|
+
case "Luminosity":
|
|
3860
|
+
return isLuminosityUom;
|
|
3861
|
+
case "Mass":
|
|
3862
|
+
return isMassUom;
|
|
3863
|
+
case "Power":
|
|
3864
|
+
return isPowerUom;
|
|
3865
|
+
case "Pressure":
|
|
3866
|
+
return isPressureUom;
|
|
3867
|
+
case "Resistance":
|
|
3868
|
+
return isResistanceUom;
|
|
3869
|
+
case "Speed":
|
|
3870
|
+
return isSpeedUom;
|
|
3871
|
+
case "Temperature":
|
|
3872
|
+
return isTemperatureUom;
|
|
3873
|
+
case "Time":
|
|
3874
|
+
return isTimeUom;
|
|
3875
|
+
case "Voltage":
|
|
3876
|
+
return isVoltageUom;
|
|
3877
|
+
case "Volume":
|
|
3878
|
+
return isVoltageUom;
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
);
|
|
3882
|
+
}
|
|
3883
|
+
function isUomCategory(...categories) {
|
|
3884
|
+
const fn2 = (val) => {
|
|
3885
|
+
const tests = getCategories2(categories);
|
|
3886
|
+
return tests.some((i) => i(val));
|
|
3887
|
+
};
|
|
3888
|
+
const prop = { categories, kind: "UomTypeGuard" };
|
|
3889
|
+
return createFnWithProps(fn2, prop);
|
|
3890
|
+
}
|
|
3791
3891
|
|
|
3792
3892
|
// src/type-guards/network-tg.ts
|
|
3793
3893
|
function isIp4Address(val) {
|
|
@@ -5896,6 +5996,7 @@ export {
|
|
|
5896
5996
|
isMassUom,
|
|
5897
5997
|
isMastercard,
|
|
5898
5998
|
isMetric,
|
|
5999
|
+
isMetricCategory,
|
|
5899
6000
|
isMexicanNewsUrl,
|
|
5900
6001
|
isMoment,
|
|
5901
6002
|
isNarrowableObject,
|
|
@@ -5927,7 +6028,7 @@ export {
|
|
|
5927
6028
|
isRegExp,
|
|
5928
6029
|
isRepoSource,
|
|
5929
6030
|
isRepoUrl,
|
|
5930
|
-
|
|
6031
|
+
isResistanceMetric,
|
|
5931
6032
|
isResistanceUom,
|
|
5932
6033
|
isRetailUrl,
|
|
5933
6034
|
isSameTypeOf,
|
|
@@ -5992,6 +6093,7 @@ export {
|
|
|
5992
6093
|
isUndefined,
|
|
5993
6094
|
isUnset,
|
|
5994
6095
|
isUom,
|
|
6096
|
+
isUomCategory,
|
|
5995
6097
|
isUri,
|
|
5996
6098
|
isUrl,
|
|
5997
6099
|
isUrlPath,
|