inferred-types 0.55.22 → 0.55.23
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 +45 -4
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +207 -115
- package/modules/inferred-types/dist/index.js +42 -4
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +53 -6
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +81 -52
- package/modules/runtime/dist/index.js +50 -6
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.d.ts +127 -64
- package/package.json +1 -1
|
@@ -3773,23 +3773,23 @@ type ValidChars<T extends readonly string[]> = [] extends T ? true : First<T> ex
|
|
|
3773
3773
|
*/
|
|
3774
3774
|
type IsVariable<T extends string> = T extends Variable ? ValidChars<Chars<T>> extends true ? true : false : false;
|
|
3775
3775
|
|
|
3776
|
-
type Process$
|
|
3776
|
+
type Process$1B<TVal, TDefault> = TVal extends Something ? TVal : TDefault;
|
|
3777
3777
|
/**
|
|
3778
3778
|
* **Default**`<TVal,TDefault,[TProtect]>`
|
|
3779
3779
|
*
|
|
3780
3780
|
* Branching operator which allows giving a value `TVal` a _default value_ when
|
|
3781
3781
|
* it's value is either `null` or `undefined`.
|
|
3782
3782
|
*/
|
|
3783
|
-
type Default<TVal, TDefault> = Process$
|
|
3783
|
+
type Default<TVal, TDefault> = Process$1B<TVal, TDefault>;
|
|
3784
3784
|
|
|
3785
|
-
type Process$
|
|
3785
|
+
type Process$1A<TConditions extends readonly boolean[], TBooleanSeen extends boolean> = [] extends TConditions ? IfEqual<TBooleanSeen, true, boolean, true> : [First<TConditions>] extends [false] ? false : Process$1A<AfterFirst<TConditions>, TBooleanSeen>;
|
|
3786
3786
|
/**
|
|
3787
3787
|
* **And**`<TConditions, [TEmpty]>`
|
|
3788
3788
|
*
|
|
3789
3789
|
* Allows an array of conditions which are either ARE a boolean value or a
|
|
3790
3790
|
* function which evaluates to a boolean value to be logically AND'd together.
|
|
3791
3791
|
*/
|
|
3792
|
-
type And<TConditions, TEmpty extends boolean = false> = TConditions extends readonly (boolean | LogicFunction)[] ? IsEqual<TConditions, []> extends true ? TEmpty : LogicalReturns<TConditions> extends readonly boolean[] ? Process$
|
|
3792
|
+
type And<TConditions, TEmpty extends boolean = false> = TConditions extends readonly (boolean | LogicFunction)[] ? IsEqual<TConditions, []> extends true ? TEmpty : LogicalReturns<TConditions> extends readonly boolean[] ? Process$1A<LogicalReturns<TConditions>, NarrowlyContains<LogicalReturns<TConditions>, boolean>> : never : never;
|
|
3793
3793
|
|
|
3794
3794
|
/**
|
|
3795
3795
|
* comparison operators which require the base type to be a string
|
|
@@ -3806,14 +3806,14 @@ type NumericComparatorOperation = "greaterThan" | "greaterThanOrEqual" | "lessTh
|
|
|
3806
3806
|
*/
|
|
3807
3807
|
type ComparatorOperation = "extends" | "equals" | StringComparatorOperation | "contains" | "containsAll" | NumericComparatorOperation | "returnEquals" | "returnExtends";
|
|
3808
3808
|
type Unionize<T> = T extends readonly unknown[] ? TupleToUnion<T> : T;
|
|
3809
|
-
type Process$
|
|
3809
|
+
type Process$1z<TVal, TOp extends ComparatorOperation, TComparator> = TOp extends "extends" ? DoesExtend<TVal, Unionize<TComparator>> : TOp extends "equals" ? IsEqual<TVal, Unionize<TComparator>> : TOp extends "contains" ? [TVal] extends [string | number | Tuple] ? Contains<TVal, TComparator> : never : TOp extends "containsAll" ? [TVal] extends [Tuple] ? [TComparator] extends [string | number | readonly string[]] ? Contains<TVal, TComparator> : never : never : TOp extends "startsWith" ? [TVal] extends [string | number] ? [TComparator] extends [string | number | readonly string[]] ? StartsWith<TVal, TComparator> : never : never : TOp extends "greaterThan" ? And<[Extends<TComparator, NumberLike>, Extends<TVal, NumberLike>]> extends true ? IsGreaterThan<As<TVal, NumberLike>, As<TComparator, NumberLike>> : never : TOp extends "greaterThanOrEqual" ? And<[Extends<TComparator, NumberLike>, Extends<TVal, NumberLike>]> extends true ? IsGreaterThanOrEqual<As<TVal, NumberLike>, As<TComparator, NumberLike>> : never : TOp extends "lessThan" ? And<[Extends<TComparator, NumberLike>, Extends<TVal, NumberLike>]> extends true ? IsLessThan<As<TVal, NumberLike>, As<TComparator, NumberLike>> : never : TOp extends "lessThanOrEqual" ? And<[Extends<TComparator, NumberLike>, Extends<TVal, NumberLike>]> extends true ? IsLessThanOrEqual<As<TVal, NumberLike>, As<TComparator, NumberLike>> : never : TOp extends "endsWith" ? [TVal] extends [string | number] ? [TComparator] extends [string | number | readonly string[]] ? EndsWith<TVal, TComparator> : never : never : TOp extends "returnEquals" ? TVal extends ((...args: any[]) => any) ? IsEqual<ReturnType<TVal>, TComparator> : false : TOp extends "returnExtends" ? TVal extends ((...args: any[]) => any) ? IsEqual<ReturnType<TVal>, TComparator> : false : never;
|
|
3810
3810
|
/**
|
|
3811
3811
|
* **Compare**`<TVal,TOp,TComparator>`
|
|
3812
3812
|
*
|
|
3813
3813
|
* Compares the value `TVal` with `TComparator` using
|
|
3814
3814
|
* the `TOp` _operator_.
|
|
3815
3815
|
*/
|
|
3816
|
-
type Compare$1<TVal, TOp extends ComparatorOperation, TComparator> = WhenNever<Process$
|
|
3816
|
+
type Compare$1<TVal, TOp extends ComparatorOperation, TComparator> = WhenNever<Process$1z<TVal, TOp, TComparator>>;
|
|
3817
3817
|
|
|
3818
3818
|
type Negate<TVal> = IsNever<TVal> extends true ? never : [TVal] extends [boolean] ? IsTrue<TVal> extends true ? false : IsFalse<TVal> extends true ? true : boolean : [TVal] extends [LogicFunction] ? Negate<ReturnType<LogicFunction>> : never;
|
|
3819
3819
|
type NegateTuple<TTuple extends readonly (boolean | LogicFunction)[], TResults extends readonly (boolean | LogicFunction)[] = []> = [] extends TTuple ? IsEqual<TResults, [], false, TResults> : NegateTuple<AfterFirst<TTuple>, [
|
|
@@ -3835,7 +3835,7 @@ type NegateTuple<TTuple extends readonly (boolean | LogicFunction)[], TResults e
|
|
|
3835
3835
|
*/
|
|
3836
3836
|
type Not<TVal, TNotBoolean extends boolean = false> = [TVal] extends [boolean] ? Exclude<As<Negate<TVal>, boolean>, any[]> : [TVal] extends [LogicFunction] ? As<Negate<ReturnType<TVal>>, boolean> : [TVal] extends [readonly (LogicFunction | boolean)[]] ? As<NegateTuple<TVal>, readonly boolean[]> : TNotBoolean;
|
|
3837
3837
|
|
|
3838
|
-
type Process$
|
|
3838
|
+
type Process$1y<TConditions extends readonly boolean[], TBooleanSean extends boolean> = NarrowlyContains<TConditions, true> extends true ? true : [IsEqual<TBooleanSean, true>] extends [true] ? boolean : false;
|
|
3839
3839
|
type ConditionError<TErr> = TErr extends ErrorCondition ? ProxyError<TErr, "Or", "TConditions"> : never;
|
|
3840
3840
|
/**
|
|
3841
3841
|
* **Or**`<TConditions, [TEmpty]>`
|
|
@@ -3848,16 +3848,16 @@ type ConditionError<TErr> = TErr extends ErrorCondition ? ProxyError<TErr, "Or",
|
|
|
3848
3848
|
*
|
|
3849
3849
|
* **Related:** `And`
|
|
3850
3850
|
*/
|
|
3851
|
-
type Or<TConditions, TEmpty extends boolean = false> = IsNever<TConditions> extends true ? Throw<"invalid-never", `Or<TConditions> received "never" for it's conditions!`, "Or"> : IsEqual<TConditions, []> extends true ? TEmpty : TConditions extends readonly (boolean | LogicFunction)[] ? LogicalReturns<TConditions> extends readonly boolean[] ? Process$
|
|
3851
|
+
type Or<TConditions, TEmpty extends boolean = false> = IsNever<TConditions> extends true ? Throw<"invalid-never", `Or<TConditions> received "never" for it's conditions!`, "Or"> : IsEqual<TConditions, []> extends true ? TEmpty : TConditions extends readonly (boolean | LogicFunction)[] ? LogicalReturns<TConditions> extends readonly boolean[] ? Process$1y<LogicalReturns<TConditions>, NarrowlyContains<LogicalReturns<TConditions>, boolean>> : never : IsErrorCondition<TConditions> extends true ? ConditionError<TConditions> : Throw<"invalid-conditions", `The conditions passed to Or<TConditions> were invalid!`, "Or", {
|
|
3852
3852
|
library: "inferred-types/constants";
|
|
3853
3853
|
value: TConditions;
|
|
3854
3854
|
}>;
|
|
3855
3855
|
|
|
3856
|
-
type Process$
|
|
3856
|
+
type Process$1x<TElements extends readonly unknown[], TOp extends ComparatorOperation, TComparator> = [] extends TElements ? false : [WhenNever<Compare$1<First<TElements>, TOp, TComparator>>] extends [true] ? true : Process$1x<AfterFirst<TElements>, TOp, TComparator>;
|
|
3857
3857
|
type Some<TContainer extends Container, TOp extends "extends" | "equals" | "startsWith" | "endsWith" | "lessThan" | "greaterThan", TComparator extends Or<[
|
|
3858
3858
|
IsEqual<TOp, "startsWith">,
|
|
3859
3859
|
IsEqual<TOp, "endsWith">
|
|
3860
|
-
]> extends true ? string : Or<[IsEqual<TOp, "lessThan">, IsEqual<TOp, "greaterThan">]> extends true ? NumberLike : unknown> = TContainer extends readonly unknown[] ? Process$
|
|
3860
|
+
]> extends true ? string : Or<[IsEqual<TOp, "lessThan">, IsEqual<TOp, "greaterThan">]> extends true ? NumberLike : unknown> = TContainer extends readonly unknown[] ? Process$1x<TContainer, TOp, TComparator> : TContainer extends Dictionary ? Process$1x<Values<TContainer>, TOp, TComparator> : never;
|
|
3861
3861
|
|
|
3862
3862
|
type AllAcc<TList extends readonly unknown[], TExtend> = [] extends TList ? true : If<Extends<First<TList>, TExtend>, AllAcc<AfterFirst<TList>, TExtend>, false>;
|
|
3863
3863
|
/**
|
|
@@ -3948,11 +3948,11 @@ type Contains<TContent extends string | number | readonly unknown[], TComparator
|
|
|
3948
3948
|
type DoesExtend<TValue, TExtends> = IsNever<TValue> extends true ? false : [TValue] extends [TExtends] ? true : false;
|
|
3949
3949
|
|
|
3950
3950
|
type Test$1<TValue extends string, TComparator extends string> = TValue extends `${string}${TComparator}` ? true : false;
|
|
3951
|
-
type Process$
|
|
3951
|
+
type Process$1w<TValue extends string, TComparator extends string> = IsStringLiteral<TComparator> extends true ? IsStringLiteral<TValue> extends true ? Test$1<TValue, TComparator> : boolean : boolean;
|
|
3952
3952
|
type ProcessEach$1<TValue extends string, TComparator extends readonly string[]> = Or<{
|
|
3953
|
-
[K in keyof TComparator]: Process$
|
|
3953
|
+
[K in keyof TComparator]: Process$1w<TValue, TComparator[K]>;
|
|
3954
3954
|
}>;
|
|
3955
|
-
type PreProcess$4<TValue extends string, TComparator extends string | readonly string[]> = TComparator extends readonly string[] ? ProcessEach$1<TValue, TComparator> : TComparator extends string ? Process$
|
|
3955
|
+
type PreProcess$4<TValue extends string, TComparator extends string | readonly string[]> = TComparator extends readonly string[] ? ProcessEach$1<TValue, TComparator> : TComparator extends string ? Process$1w<TValue, TComparator> : never;
|
|
3956
3956
|
/**
|
|
3957
3957
|
* **EndsWith**<TValue, TComparator>
|
|
3958
3958
|
*
|
|
@@ -3989,13 +3989,13 @@ type _HasArray<TList extends readonly unknown[]> = [] extends TList ? false : Is
|
|
|
3989
3989
|
*/
|
|
3990
3990
|
type HasArray<TList extends readonly unknown[]> = _HasArray<TList>;
|
|
3991
3991
|
|
|
3992
|
-
type Process$
|
|
3992
|
+
type Process$1v<TStr extends string, TChars extends string, _TOp extends "any" | "all"> = TStr extends `${string}${TChars}${string}` ? true : false;
|
|
3993
3993
|
type ProcessTuple$4<TStr extends string, TChars extends readonly string[], TOp extends "any" | "all"> = TOp extends "any" ? Or<{
|
|
3994
3994
|
[K in keyof TChars]: TStr extends `${string}${TChars[K]}${string}` ? true : false;
|
|
3995
3995
|
}> : And<{
|
|
3996
3996
|
[K in keyof TChars]: TStr extends `${string}${TChars[K]}${string}` ? true : false;
|
|
3997
3997
|
}>;
|
|
3998
|
-
type PreProcess$3<TStr extends string, TChars extends string, TOp extends "any" | "all"> = IsUnion<TChars> extends true ? UnionToTuple$1<TChars> extends readonly string[] ? ProcessTuple$4<TStr, UnionToTuple$1<TChars>, TOp> : never : Process$
|
|
3998
|
+
type PreProcess$3<TStr extends string, TChars extends string, TOp extends "any" | "all"> = IsUnion<TChars> extends true ? UnionToTuple$1<TChars> extends readonly string[] ? ProcessTuple$4<TStr, UnionToTuple$1<TChars>, TOp> : never : Process$1v<TStr, TChars, TOp>;
|
|
3999
3999
|
/**
|
|
4000
4000
|
* **HasCharacters**`<TStr,TChars>`
|
|
4001
4001
|
*
|
|
@@ -4009,7 +4009,7 @@ type PreProcess$3<TStr extends string, TChars extends string, TOp extends "any"
|
|
|
4009
4009
|
*/
|
|
4010
4010
|
type HasCharacters<TStr extends string, TChars extends string | readonly string[], TOp extends "any" | "all" = "any"> = IsStringLiteral<TStr> extends true ? TChars extends string ? IsStringLiteral<TChars> extends true ? PreProcess$3<TStr, TChars, TOp> : boolean : TChars extends readonly string[] ? AllStringLiterals<AsArray<TChars>> extends true ? ProcessTuple$4<TStr, TChars, TOp> : boolean : boolean : boolean;
|
|
4011
4011
|
|
|
4012
|
-
type Process$
|
|
4012
|
+
type Process$1u<TStr extends string, TChars extends string> = ReplaceAll<TStr, TChars, ""> extends "" ? false : true;
|
|
4013
4013
|
/**
|
|
4014
4014
|
* **HasOtherCharacters**`<TStr,TChars>`
|
|
4015
4015
|
*
|
|
@@ -4021,7 +4021,7 @@ type Process$1t<TStr extends string, TChars extends string> = ReplaceAll<TStr, T
|
|
|
4021
4021
|
*
|
|
4022
4022
|
* **Related:** `HasCharacters`
|
|
4023
4023
|
*/
|
|
4024
|
-
type HasOtherCharacters<TStr extends string, TChars extends string | readonly string[]> = [IsWideType<TStr>] extends [true] ? boolean : [TChars] extends [string] ? IsWideType<TChars> extends true ? boolean : Process$
|
|
4024
|
+
type HasOtherCharacters<TStr extends string, TChars extends string | readonly string[]> = [IsWideType<TStr>] extends [true] ? boolean : [TChars] extends [string] ? IsWideType<TChars> extends true ? boolean : Process$1u<TStr, TChars> : TChars extends readonly string[] ? Process$1u<TStr, TupleToUnion<TChars>> : never;
|
|
4025
4025
|
|
|
4026
4026
|
/**
|
|
4027
4027
|
* **HasParameters**`<T>`
|
|
@@ -4261,7 +4261,7 @@ type Validations<T> = IsStringLiteral<T> extends true ? true : IsNumericLiteral<
|
|
|
4261
4261
|
*/
|
|
4262
4262
|
type IsLiteral<T> = [IsUnion<T>] extends [true] ? false : Validations<T>;
|
|
4263
4263
|
|
|
4264
|
-
type Process$
|
|
4264
|
+
type Process$1r<T> = UnionToTuple$1<T> extends readonly unknown[] ? RetainLiterals<UnionToTuple$1<T>>["length"] extends UnionToTuple$1<T>["length"] ? true : false : never;
|
|
4265
4265
|
/**
|
|
4266
4266
|
* **IsLiteralUnion**`<T>`
|
|
4267
4267
|
*
|
|
@@ -4270,7 +4270,7 @@ type Process$1q<T> = UnionToTuple$1<T> extends readonly unknown[] ? RetainLitera
|
|
|
4270
4270
|
*
|
|
4271
4271
|
* **Related:** `IsLiteralUnion`, `IsWideUnion`
|
|
4272
4272
|
*/
|
|
4273
|
-
type IsLiteralUnion<T> = [IsUnion<T>] extends [true] ? Process$
|
|
4273
|
+
type IsLiteralUnion<T> = [IsUnion<T>] extends [true] ? Process$1r<T> : false;
|
|
4274
4274
|
|
|
4275
4275
|
/**
|
|
4276
4276
|
* **IsNarrowingFn**`<TFn>`
|
|
@@ -4389,7 +4389,7 @@ type IsSingleChar<T> = T extends string ? Length<T> extends 1 ? true : If<IsStri
|
|
|
4389
4389
|
*/
|
|
4390
4390
|
type IsString<T> = [IsUnion<T>] extends [true] ? WidenUnion<T> extends string ? true : string extends WidenUnion<T> ? boolean : false : [T] extends [string] ? true : false;
|
|
4391
4391
|
|
|
4392
|
-
type Process$
|
|
4392
|
+
type Process$1o<T, TNever> = [IsNever<T>] extends [true] ? TNever : [IsEqual<T, true>] extends [true] ? true : false;
|
|
4393
4393
|
/**
|
|
4394
4394
|
* **IsTrue**`<T,[TNever]>`
|
|
4395
4395
|
*
|
|
@@ -4403,9 +4403,9 @@ type Process$1n<T, TNever> = [IsNever<T>] extends [true] ? TNever : [IsEqual<T,
|
|
|
4403
4403
|
* type F2 = IsTrue<"foobar">;
|
|
4404
4404
|
* ```
|
|
4405
4405
|
*/
|
|
4406
|
-
type IsTrue<T, TNever = never> = Process$
|
|
4406
|
+
type IsTrue<T, TNever = never> = Process$1o<T, TNever>;
|
|
4407
4407
|
|
|
4408
|
-
type Process$
|
|
4408
|
+
type Process$1n<T> = [IsNever<T>] extends [true] ? false : T extends readonly unknown[] ? number extends T["length"] ? false : true : false;
|
|
4409
4409
|
/**
|
|
4410
4410
|
* **IsTuple**`<T>`
|
|
4411
4411
|
*
|
|
@@ -4418,7 +4418,7 @@ type Process$1m<T> = [IsNever<T>] extends [true] ? false : T extends readonly un
|
|
|
4418
4418
|
* - types such as `string[]`, etc. are _not_ tuples as they
|
|
4419
4419
|
* do not discretely specify a length of elements
|
|
4420
4420
|
*/
|
|
4421
|
-
type IsTuple<T> = Process$
|
|
4421
|
+
type IsTuple<T> = Process$1n<T> extends boolean ? Process$1n<T> : never;
|
|
4422
4422
|
|
|
4423
4423
|
/**
|
|
4424
4424
|
* **IsUndefined**
|
|
@@ -4570,7 +4570,7 @@ type InvalidNever = Throw<"invalid-never", `The value of T when calling IsWideTy
|
|
|
4570
4570
|
*/
|
|
4571
4571
|
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;
|
|
4572
4572
|
|
|
4573
|
-
type Process$
|
|
4573
|
+
type Process$1m<T extends readonly unknown[]> = {
|
|
4574
4574
|
[K in keyof T]: IsWideType<T[K]> extends true ? true : Or<[IsUndefined<T[K]>, IsNull<T[K]>]> extends true ? true : false;
|
|
4575
4575
|
};
|
|
4576
4576
|
/**
|
|
@@ -4581,7 +4581,7 @@ type Process$1l<T extends readonly unknown[]> = {
|
|
|
4581
4581
|
*
|
|
4582
4582
|
* **Related:** `IsNonLiteralUnion`
|
|
4583
4583
|
*/
|
|
4584
|
-
type IsWideUnion<T> = [IsUnion<T>] extends [true] ? [Process$
|
|
4584
|
+
type IsWideUnion<T> = [IsUnion<T>] extends [true] ? [Process$1m<UnionToTuple$1<T>>] extends [readonly true[]] ? true : false : false;
|
|
4585
4585
|
|
|
4586
4586
|
type Overlap<TKeys extends readonly ObjectKey[], TComparator extends AnyObject> = [] extends TKeys ? false : First<TKeys> extends keyof TComparator ? true : Overlap<AfterFirst<TKeys>, TComparator>;
|
|
4587
4587
|
/**
|
|
@@ -4670,7 +4670,7 @@ type HasQueryParameter<T extends string, P extends string> = And<[
|
|
|
4670
4670
|
]> extends true ? GetUrlQueryParams<T> extends `${string}${P}=${string}` ? true : false : boolean;
|
|
4671
4671
|
|
|
4672
4672
|
type Check<TValue extends string, TComparator extends string | number> = TValue extends `${TComparator}${string}` ? true : false;
|
|
4673
|
-
type Process$
|
|
4673
|
+
type Process$1l<TValue extends string, TComparator extends string | number | readonly string[]> = TComparator extends readonly string[] ? Check<[
|
|
4674
4674
|
TValue
|
|
4675
4675
|
] extends [number] ? `${TValue}` : TValue, TupleToUnion<TComparator>> : Check<[
|
|
4676
4676
|
TValue
|
|
@@ -4689,9 +4689,9 @@ type Process$1k<TValue extends string, TComparator extends string | number | rea
|
|
|
4689
4689
|
* - this can be much more type efficient for unions with lots of characters
|
|
4690
4690
|
* - if you need larger pattern matches then use a Tuple for `TComparator`
|
|
4691
4691
|
*/
|
|
4692
|
-
type StartsWith<TValue extends string | number, TComparator extends string | number | readonly string[]> = [IsWideType<TValue>] extends [true] ? boolean : [IsWideType<TComparator>] extends [true] ? boolean : IsEqual<Process$
|
|
4692
|
+
type StartsWith<TValue extends string | number, TComparator extends string | number | readonly string[]> = [IsWideType<TValue>] extends [true] ? boolean : [IsWideType<TComparator>] extends [true] ? boolean : IsEqual<Process$1l<AsString<TValue>, TComparator>, boolean> extends true ? true : Process$1l<AsString<TValue>, TComparator>;
|
|
4693
4693
|
|
|
4694
|
-
type Process$
|
|
4694
|
+
type Process$1k<T extends readonly unknown[]> = HasArray<T> extends true ? true : false;
|
|
4695
4695
|
/**
|
|
4696
4696
|
* **UnionHasArray**`<T>`
|
|
4697
4697
|
*
|
|
@@ -4701,7 +4701,7 @@ type Process$1j<T extends readonly unknown[]> = HasArray<T> extends true ? true
|
|
|
4701
4701
|
* - and that one of the elements of the union is an array
|
|
4702
4702
|
* of some sort.
|
|
4703
4703
|
*/
|
|
4704
|
-
type UnionHasArray<T> = IsUnion<T> extends true ? Process$
|
|
4704
|
+
type UnionHasArray<T> = IsUnion<T> extends true ? Process$1k<UnionToTuple$1<T>> : false;
|
|
4705
4705
|
|
|
4706
4706
|
type ShouldFail<TTest> = [IsNever<TTest>] extends [true] ? true : [IsFalse<TTest>] extends [true] ? true : false;
|
|
4707
4707
|
type Iterate$8<TTest extends readonly unknown[]> = Or<{
|
|
@@ -4811,8 +4811,8 @@ type Merge$1<TUser extends Partial<OnPassRemap>, TKeys extends readonly (ObjectK
|
|
|
4811
4811
|
false: false;
|
|
4812
4812
|
error: Constant$1<"not-set">;
|
|
4813
4813
|
}> = [] extends TKeys ? TConfig : Merge$1<TUser, AfterFirst<TKeys>, As<ExpandDictionary<Record<First<TKeys>, TUser[First<TKeys>]> & Omit<TConfig, First<TKeys>>>, OnPassRemap>>;
|
|
4814
|
-
type Process$
|
|
4815
|
-
type Iterate$7<TTest extends readonly unknown[], TPass, TRemap extends OnPassRemap<unknown, unknown, unknown>> = [] extends TTest ? TPass : Process$
|
|
4814
|
+
type Process$1i<TTest, TPass, TRemap extends OnPassRemap<unknown, unknown, unknown>> = [IsNever<TTest>] extends [true] ? TRemap["never"] : [IsErrorCondition<TTest>] extends [true] ? TRemap["error"] extends Constant$1<"not-set"> ? TTest : TRemap["error"] : [IsFalse<TTest>] extends [true] ? TRemap["false"] : TPass;
|
|
4815
|
+
type Iterate$7<TTest extends readonly unknown[], TPass, TRemap extends OnPassRemap<unknown, unknown, unknown>> = [] extends TTest ? TPass : Process$1i<First<TTest>, TPass, TRemap> extends TPass ? Iterate$7<AfterFirst<TTest>, TPass, TRemap> : Process$1i<First<TTest>, TPass, TRemap>;
|
|
4816
4816
|
/**
|
|
4817
4817
|
* **OnPass**`<TTest, TPass,[TRemap],[TFalse]>`
|
|
4818
4818
|
*
|
|
@@ -4826,7 +4826,7 @@ type Iterate$7<TTest extends readonly unknown[], TPass, TRemap extends OnPassRem
|
|
|
4826
4826
|
* - the `TRemap` allows you to remap error conditions
|
|
4827
4827
|
* as well if needed
|
|
4828
4828
|
*/
|
|
4829
|
-
type OnPass<TTest, TPass, TRemap extends Partial<OnPassRemap<unknown, unknown, unknown>> = OnPassRemap<never, false, Constant$1<"not-set">>> = TTest extends readonly unknown[] ? Iterate$7<TTest, TPass, TRemap extends OnPassRemap<never, false, Constant$1<"not-set">> ? TRemap : Merge$1<TRemap, Keys<TRemap>>> : Process$
|
|
4829
|
+
type OnPass<TTest, TPass, TRemap extends Partial<OnPassRemap<unknown, unknown, unknown>> = OnPassRemap<never, false, Constant$1<"not-set">>> = TTest extends readonly unknown[] ? Iterate$7<TTest, TPass, TRemap extends OnPassRemap<never, false, Constant$1<"not-set">> ? TRemap : Merge$1<TRemap, Keys<TRemap>>> : Process$1i<TTest, TPass, TRemap extends OnPassRemap<never, false, Constant$1<"not-set">> ? TRemap : Merge$1<TRemap, Keys<TRemap>>>;
|
|
4830
4830
|
|
|
4831
4831
|
/**
|
|
4832
4832
|
* **WhenNever**`<T, [TMapTo]>`
|
|
@@ -4905,13 +4905,13 @@ type RemoveEmpty<T> = T extends Tuple ? As<RemoveMarked<ProcessTup<T>>, readonly
|
|
|
4905
4905
|
|
|
4906
4906
|
type Marked$2 = typeof MARKED;
|
|
4907
4907
|
type _Keys$4<T extends object> = UnionToTuple$1<keyof RemoveIndexKeys<T>> extends readonly ObjectKey[] ? UnionToTuple$1<keyof RemoveIndexKeys<T>> : never;
|
|
4908
|
-
type Process$
|
|
4908
|
+
type Process$1g<T extends Container, TKeys extends readonly PropertyKey[], TResults extends Container = T extends readonly unknown[] ? [] : EmptyObject> = [] extends TKeys ? TResults : First<TKeys> extends keyof T ? DoesExtend<T[First<TKeys>], Marked$2> extends true ? Process$1g<T, AfterFirst<TKeys>, TResults> : Process$1g<T, AfterFirst<TKeys>, First<TKeys> extends keyof T ? TResults extends readonly unknown[] ? [...TResults, T[First<TKeys>]] : TResults extends Dictionary ? TResults & Record<First<TKeys>, T[First<TKeys>]> : never : never> : never;
|
|
4909
4909
|
/**
|
|
4910
4910
|
* **RemoveMarked**`<T>`
|
|
4911
4911
|
*
|
|
4912
4912
|
* Removes all values in `T` which extends `Constant<"Marked">`
|
|
4913
4913
|
*/
|
|
4914
|
-
type RemoveMarked<T extends Container> = Process$
|
|
4914
|
+
type RemoveMarked<T extends Container> = Process$1g<T, T extends Tuple ? NumericKeys<T> : _Keys$4<T>>;
|
|
4915
4915
|
|
|
4916
4916
|
/**
|
|
4917
4917
|
* **RemoveIndexKeys**`<T>`
|
|
@@ -4949,7 +4949,7 @@ type _AsArray<T> = T extends Tuple ? Mutable<T> : If<IsUndefined<T>, [
|
|
|
4949
4949
|
*/
|
|
4950
4950
|
type AsArray<T> = _AsArray<T> extends any[] ? _AsArray<T> : never;
|
|
4951
4951
|
|
|
4952
|
-
type Process$
|
|
4952
|
+
type Process$1f<T extends `${number}`> = If<IsStringLiteral<T>, StripLeading<T, "-">, string>;
|
|
4953
4953
|
/**
|
|
4954
4954
|
* **Abs**`<T>`
|
|
4955
4955
|
*
|
|
@@ -4958,7 +4958,7 @@ type Process$1e<T extends `${number}`> = If<IsStringLiteral<T>, StripLeading<T,
|
|
|
4958
4958
|
* - you can pass in a numeric string literal and it perform ABS func while
|
|
4959
4959
|
* preserving string literal type
|
|
4960
4960
|
*/
|
|
4961
|
-
type Abs<T extends NumberLike> = T extends number ? AsNumber<Process$
|
|
4961
|
+
type Abs<T extends NumberLike> = T extends number ? AsNumber<Process$1f<`${T}`>> : T extends `${number}` ? Process$1f<T> : never;
|
|
4962
4962
|
|
|
4963
4963
|
/**
|
|
4964
4964
|
* **NumericChar**
|
|
@@ -4982,13 +4982,13 @@ type GrowExp<A extends any[], N extends number, P extends any[][], L extends num
|
|
|
4982
4982
|
type MapItemType<T, I> = {
|
|
4983
4983
|
[K in keyof T]: I;
|
|
4984
4984
|
};
|
|
4985
|
-
type Process$
|
|
4985
|
+
type Process$1e<T, N extends number> = N extends 0 ? [] : MapItemType<GrowExp<[0], N, []>, T>;
|
|
4986
4986
|
/**
|
|
4987
4987
|
* **FixedLengthArray**`<T,N>`
|
|
4988
4988
|
*
|
|
4989
4989
|
* Creates a fixed length `<N>` array of a given type `<T>`
|
|
4990
4990
|
*/
|
|
4991
|
-
type FixedLengthArray<T, N extends number> = Process$
|
|
4991
|
+
type FixedLengthArray<T, N extends number> = Process$1e<T, N> extends readonly unknown[] ? Process$1e<T, N> : never;
|
|
4992
4992
|
|
|
4993
4993
|
/**
|
|
4994
4994
|
* **ParseInt**`<T>`
|
|
@@ -5011,7 +5011,7 @@ type ParseInt<T> = T extends `${infer N extends number}` ? N : never;
|
|
|
5011
5011
|
*/
|
|
5012
5012
|
type AsNumber<T> = T extends number ? T : T extends `${number}` ? ParseInt<T> : never;
|
|
5013
5013
|
|
|
5014
|
-
type Process$
|
|
5014
|
+
type Process$1d<TTuple extends readonly string[], TSeparator extends string, TResult extends string = ""> = [] extends TTuple ? TResult : Process$1d<AfterFirst<TTuple>, TSeparator, TResult extends "" ? First<TTuple> extends "" ? TResult : `${First<TTuple>}` : First<TTuple> extends "" ? TResult : `${TResult}${TSeparator}${First<TTuple>}`>;
|
|
5015
5015
|
type Slicer<TTuple extends readonly unknown[], TMax extends number | null, TEllipsis extends string | false> = TMax extends number ? TakeFirst<TTuple, TMax> extends readonly unknown[] ? TEllipsis extends string ? ToStringArray<[...TakeFirst<TTuple, TMax>, TEllipsis]> : ToStringArray<TakeFirst<TTuple, TMax>> : never : ToStringArray<TTuple>;
|
|
5016
5016
|
/**
|
|
5017
5017
|
* **Join**`<TArr,[TSeparator],[TMax]>`
|
|
@@ -5026,7 +5026,7 @@ type Slicer<TTuple extends readonly unknown[], TMax extends number | null, TElli
|
|
|
5026
5026
|
*
|
|
5027
5027
|
* **Related:** `Concat<TArr>`
|
|
5028
5028
|
*/
|
|
5029
|
-
type Join<TTuple extends readonly unknown[], TSeparator extends string = "", TMax extends number | null = null, TEllipsis extends string | false = "..."> = ToStringArray<TTuple> extends readonly string[] ? TMax extends number ? IsGreaterThan<TTuple["length"], TMax> extends true ? Process$
|
|
5029
|
+
type Join<TTuple extends readonly unknown[], TSeparator extends string = "", TMax extends number | null = null, TEllipsis extends string | false = "..."> = ToStringArray<TTuple> extends readonly string[] ? TMax extends number ? IsGreaterThan<TTuple["length"], TMax> extends true ? Process$1d<Slicer<TTuple, TMax, TEllipsis>, TSeparator> : Process$1d<ToStringArray<TTuple>, TSeparator> : Process$1d<ToStringArray<TTuple>, TSeparator> : never;
|
|
5030
5030
|
|
|
5031
5031
|
/**
|
|
5032
5032
|
* **AsString**<T>
|
|
@@ -5112,9 +5112,9 @@ type RightMostDigit<s extends string> = s extends `${infer rest}${NumericChar}`
|
|
|
5112
5112
|
type SumStrings<left extends string, right extends string, accumulatedResultDigits extends string = "", carry extends boolean = false> = "" extends left ? "" extends right ? carry extends true ? `1${accumulatedResultDigits}` : accumulatedResultDigits : RightMostDigit<right> extends RightMostDigitResult<infer remainingRight, infer rightDigit> ? SumSingleDigits<"0", rightDigit, carry> extends SingleDigitSumResult<infer resultDigit, infer resultCarry> ? SumStrings<"", remainingRight, `${resultDigit}${accumulatedResultDigits}`, resultCarry> : never : never : "" extends right ? RightMostDigit<left> extends RightMostDigitResult<infer remainingLeft, infer leftDigit> ? SumSingleDigits<"0", leftDigit, carry> extends SingleDigitSumResult<infer resultDigit, infer resultCarry> ? SumStrings<remainingLeft, "", `${resultDigit}${accumulatedResultDigits}`, resultCarry> : never : never : RightMostDigit<left> extends RightMostDigitResult<infer remainingLeft, infer leftDigit> ? RightMostDigit<right> extends RightMostDigitResult<infer remainingRight, infer rightDigit> ? SumSingleDigits<leftDigit, rightDigit, carry> extends SingleDigitSumResult<infer resultDigit, infer resultCarry> ? SumStrings<remainingLeft, remainingRight, `${resultDigit}${accumulatedResultDigits}`, resultCarry> : never : never : never;
|
|
5113
5113
|
type _Subtract<TValue extends `${number}`, TCountArr extends readonly unknown[]> = [] extends TCountArr ? TValue : _Subtract<Decrement<TValue>, AfterFirst<TCountArr>>;
|
|
5114
5114
|
type AddNegatives<A extends `${number}`, B extends `${number}`> = SumStrings<A, B>;
|
|
5115
|
-
type Process$
|
|
5115
|
+
type Process$1c<A extends `${number}`, B extends `${number}`> = And<[IsNegativeNumber<A>, IsNegativeNumber<B>]> extends true ? `-${AddNegatives<Abs<A>, Abs<B>>}` : IsNegativeNumber<B> extends true ? FixedLengthArray<unknown, AsNumber<Abs<B>>> extends readonly unknown[] ? _Subtract<A, FixedLengthArray<unknown, AsNumber<Abs<B>>>> : never : IsNegativeNumber<A> extends true ? FixedLengthArray<unknown, AsNumber<Abs<A>>> extends readonly unknown[] ? _Subtract<B, FixedLengthArray<unknown, AsNumber<Abs<A>>>> : never : SumStrings<A, B>;
|
|
5116
5116
|
type CheckWide<A extends NumberLike, B extends NumberLike> = IsWideType<A> extends true ? true : IsWideType<B> extends true ? true : false;
|
|
5117
|
-
type PreProcess$2<A extends NumberLike, B extends NumberLike> = CheckWide<A, B> extends true ? Or<[IsString<A>, IsString<A>]> extends true ? string : number : Or<[IsWideType<A>, IsWideType<B>]> extends true ? If<IsString<A>, string, number> : A extends `${number}` ? B extends `${number}` ? As<Process$
|
|
5117
|
+
type PreProcess$2<A extends NumberLike, B extends NumberLike> = CheckWide<A, B> extends true ? Or<[IsString<A>, IsString<A>]> extends true ? string : number : Or<[IsWideType<A>, IsWideType<B>]> extends true ? If<IsString<A>, string, number> : A extends `${number}` ? B extends `${number}` ? As<Process$1c<A, B>, `${number}`> : As<Process$1c<A, AsString<B>>, `${number}`> : A extends number ? B extends number ? AsNumber<Process$1c<`${A}`, `${B}`>> : AsNumber<Process$1c<`${A}`, As<B, `${number}`>>> : never;
|
|
5118
5118
|
/**
|
|
5119
5119
|
* **Add**`<A,B>`
|
|
5120
5120
|
*
|
|
@@ -5309,7 +5309,7 @@ type ProxyError<TError extends ErrorCondition, TUtility extends string, TGeneric
|
|
|
5309
5309
|
* Iterates over each element of the Tuple
|
|
5310
5310
|
*/
|
|
5311
5311
|
type SingleFilter$3<TList extends readonly unknown[], TFilter, TOp extends ComparatorOperation, Result extends unknown[] = []> = TList extends [infer Head, ...infer Rest] ? [Compare$1<Head, TOp, TFilter>] extends [true] ? SingleFilter$3<Rest, TFilter, TOp, Result> : SingleFilter$3<Rest, TFilter, TOp, [...Result, Head]> : Result;
|
|
5312
|
-
type Process$
|
|
5312
|
+
type Process$19<TList extends unknown[] | readonly unknown[], TFilter, TOp extends ComparatorOperation> = TList extends unknown[] ? SingleFilter$3<TList, TFilter, TOp> : TList extends readonly unknown[] ? Readonly<SingleFilter$3<[...TList], TFilter, TOp>> : never;
|
|
5313
5313
|
/**
|
|
5314
5314
|
* **Filter**`<TList, TComparator, [TOp]>`
|
|
5315
5315
|
*
|
|
@@ -5333,7 +5333,7 @@ type Process$18<TList extends unknown[] | readonly unknown[], TFilter, TOp exten
|
|
|
5333
5333
|
*
|
|
5334
5334
|
* **Related:** `RetainFromList`, `RemoveFromList`
|
|
5335
5335
|
*/
|
|
5336
|
-
type Filter<TList extends readonly unknown[], TComparator, TOp extends ComparatorOperation = "extends"> = TList extends readonly unknown[] ? IfNever<TComparator, RemoveNever<TList>, If<IsArray<TComparator>, Process$
|
|
5336
|
+
type Filter<TList extends readonly unknown[], TComparator, TOp extends ComparatorOperation = "extends"> = TList extends readonly unknown[] ? IfNever<TComparator, RemoveNever<TList>, If<IsArray<TComparator>, Process$19<TList, TupleToUnion<TComparator>, TOp>, Process$19<TList, TComparator, TOp>>> : never;
|
|
5337
5337
|
|
|
5338
5338
|
/**
|
|
5339
5339
|
* Converts a Tuple type into a _union_ of the tuple elements
|
|
@@ -5366,7 +5366,13 @@ type LastInUnion$1<U> = UnionToIntersection$2<U extends unknown ? (x: U) => 0 :
|
|
|
5366
5366
|
*/
|
|
5367
5367
|
type UnionToTuple$1<U, Last = LastInUnion$1<U>> = [U] extends [never] ? [] : [...UnionToTuple$1<Exclude<U, Last>>, Last];
|
|
5368
5368
|
|
|
5369
|
-
|
|
5369
|
+
/**
|
|
5370
|
+
* **AsObject<T>**
|
|
5371
|
+
*
|
|
5372
|
+
* Proxies through any ony existing object, but will also
|
|
5373
|
+
* convert a `KeyValueTuple` into an object.
|
|
5374
|
+
*/
|
|
5375
|
+
type AsObject<T> = T extends AnyObject ? T : never;
|
|
5370
5376
|
|
|
5371
5377
|
/**
|
|
5372
5378
|
* **AsPropertyKey**`<T>`
|
|
@@ -9117,13 +9123,15 @@ type Compact<TSource extends AnyObject, TKeys extends readonly (ObjectKey & keyo
|
|
|
9117
9123
|
*
|
|
9118
9124
|
* Type utility to convert an object to an array of object based key-value pairs.
|
|
9119
9125
|
*
|
|
9120
|
-
* Example
|
|
9126
|
+
* **Example:**
|
|
9121
9127
|
* ```ts
|
|
9122
9128
|
* // readonly [ {key: "foo", value: 1} ]
|
|
9123
9129
|
* type T = ObjectToTuple<{ foo: 1 }>
|
|
9124
9130
|
* // readonly [ { foo: 1 } ]
|
|
9125
9131
|
* type C = ObjectToTuple< foo: 1 }, true>;
|
|
9126
9132
|
* ```
|
|
9133
|
+
*
|
|
9134
|
+
* **Related:** `ToKv`, `FromKv`
|
|
9127
9135
|
*/
|
|
9128
9136
|
type ObjectToTuple<TObj extends AnyObject, TCompact extends boolean = false> = TObj extends ExplicitlyEmptyObject ? [] : IsWideContainer<TObj> extends true ? TCompact extends false ? KeyValue[] : Record<ObjectKey, any>[] : TCompact extends false ? Process$P<TObj, As<Keys<TObj>, readonly (ObjectKey & keyof TObj)[]>> : Compact<TObj, As<Keys<TObj>, readonly (ObjectKey & keyof TObj)[]>>;
|
|
9129
9137
|
|
|
@@ -11767,7 +11775,7 @@ type Process$2<TObj extends AnyObject, TKeys extends readonly (ObjectKey & keyof
|
|
|
11767
11775
|
* you can get a somewhat less strict tuple type by setting `TKeys` to `false`
|
|
11768
11776
|
* - Ok ... _now that you're sorted_ ...
|
|
11769
11777
|
*
|
|
11770
|
-
* **Related:** `KeyValue`, `FromKv`
|
|
11778
|
+
* **Related:** `KeyValue`, `FromKv`, `ObjectToTuple`, `TupleToObject`
|
|
11771
11779
|
*/
|
|
11772
11780
|
type ToKv<TObj extends AnyObject, TKeys extends (readonly (ObjectKey & keyof TObj)[]) | false = As<Keys<TObj>, (readonly (ObjectKey & keyof TObj)[])>> = IsObjectLiteral<TObj> extends true ? TKeys extends readonly (ObjectKey & keyof TObj)[] ? Process$2<TObj, TKeys> : Array<{
|
|
11773
11781
|
[K in keyof TObj]: {
|
|
@@ -12070,6 +12078,10 @@ declare function ifChar<T extends string, IF extends Narrowable, ELSE extends Na
|
|
|
12070
12078
|
|
|
12071
12079
|
declare function ifContainer<TVal extends Narrowable, TIf extends Narrowable, TElse extends Narrowable>(value: TVal, ifContainer: <V extends TVal & Container>(val: V) => TIf, notContainer: <V extends Exclude<TVal, Container>>(val: V) => TElse): If<IsContainer<TVal>, TIf, TElse>;
|
|
12072
12080
|
|
|
12081
|
+
type Rtn$3<TComparator, TVal, TIf extends <T extends TComparator & TVal>(val: T) => unknown, TElse extends <T extends Exclude<TVal, TComparator>>(val: T) => unknown> = Or<[IsWideType<TComparator>, IsWideType<TVal>]> extends true ? ReturnType<TIf> | ReturnType<TElse> : If<IsEqual<TComparator, TVal>, ReturnType<TIf>, ReturnType<TElse>>;
|
|
12082
|
+
type IfEqualTest<TComparator> = <TVal extends Narrowable, TIf extends <T extends TComparator & TVal>(val: T) => unknown, TElse extends <T extends Exclude<TVal, TComparator>>(val: T) => unknown>(val: TVal, ifTrue: TIf, ifFalse: TElse) => Rtn$3<TComparator, TVal, TIf, TElse>;
|
|
12083
|
+
declare function ifEqual<TComparator extends Narrowable>(comparator: TComparator): IfEqualTest<TComparator>;
|
|
12084
|
+
|
|
12073
12085
|
/**
|
|
12074
12086
|
* **ifTrue**
|
|
12075
12087
|
*
|
|
@@ -12879,6 +12891,20 @@ declare function last<T extends Tuple>(list: T): Last<T>;
|
|
|
12879
12891
|
|
|
12880
12892
|
declare function logicalReturns<TConditions extends readonly (boolean | LogicFunction)[]>(conditions: TConditions): LogicalReturns<TConditions>;
|
|
12881
12893
|
|
|
12894
|
+
type MapOverObject<TObj extends AnyObject> = {
|
|
12895
|
+
kind: "MapOverObject";
|
|
12896
|
+
} & (<TCb extends <K extends ToKv<TObj>[number]>(cb: K) => unknown>(cb: TCb) => {
|
|
12897
|
+
[K in keyof TObj]: ReturnType<TCb>;
|
|
12898
|
+
});
|
|
12899
|
+
type MapOverObjectToArray<TContainer extends AnyObject> = {
|
|
12900
|
+
kind: "MapOverObjectToArray";
|
|
12901
|
+
} & (<K extends keyof TContainer & PropertyKey>(k: K, v: TContainer[K]) => unknown);
|
|
12902
|
+
type MapOverArray<TContainer extends readonly unknown[]> = {
|
|
12903
|
+
kind: "MapOverArray";
|
|
12904
|
+
} & (<K extends keyof TContainer & PropertyKey>(k: K, v: TContainer[K]) => unknown);
|
|
12905
|
+
type MapOver<TContainer extends AnyObject | readonly unknown[], TArr extends boolean = false> = TContainer extends readonly unknown[] ? MapOverArray<TContainer> : TContainer extends AnyObject ? [TArr] extends [true] ? MapOverObjectToArray<TContainer> : MapOverObject<TContainer> : never;
|
|
12906
|
+
declare function mapOver<TContainer extends NarrowObject<N> | AnyObject, N extends Narrowable, TArr extends boolean>(input: TContainer, toArray?: TArr): MapOver<TContainer, TArr>;
|
|
12907
|
+
|
|
12882
12908
|
/**
|
|
12883
12909
|
* **reverse**(list)
|
|
12884
12910
|
*
|
|
@@ -14175,9 +14201,7 @@ type Returns$1<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefin
|
|
|
14175
14201
|
* const rec = toKeyValue({foo: 1, bar: 2, id: 123 }, o => o.toTop("id"));
|
|
14176
14202
|
* ```
|
|
14177
14203
|
*/
|
|
14178
|
-
declare function toKeyValue<T extends
|
|
14179
|
-
[key: string]: N;
|
|
14180
|
-
}, N extends Narrowable, S extends ToKeyValueSort<SKeys<T>> | undefined>(obj: T, sort?: S): Returns$1<T, S>;
|
|
14204
|
+
declare function toKeyValue<T extends NarrowObject<N> | AnyObject, N extends Narrowable, S extends ToKeyValueSort<SKeys<T>> | undefined>(obj: T, sort?: S): Returns$1<T, S>;
|
|
14181
14205
|
|
|
14182
14206
|
/**
|
|
14183
14207
|
* **toNumber**(value)
|
|
@@ -14497,7 +14521,7 @@ declare function hasIndexOf<TContainer extends Container, TIndex extends Propert
|
|
|
14497
14521
|
* properties passed into this first call.
|
|
14498
14522
|
*
|
|
14499
14523
|
* ```ts
|
|
14500
|
-
* const hasFooBar = hasKeys(
|
|
14524
|
+
* const hasFooBar = hasKeys("foo", "bar"); // type guard
|
|
14501
14525
|
* const hasFooBarToo = hasKeys({foo: 1, bar: 1});
|
|
14502
14526
|
* ```
|
|
14503
14527
|
*/
|
|
@@ -14929,6 +14953,11 @@ declare function isObject(value: unknown): value is Dictionary;
|
|
|
14929
14953
|
*/
|
|
14930
14954
|
declare function isNarrowableObject(value: unknown): value is Dictionary<ObjectKey, Narrowable>;
|
|
14931
14955
|
|
|
14956
|
+
/**
|
|
14957
|
+
* Type guard which validates that `val` is a valid `ObjectKey`
|
|
14958
|
+
*/
|
|
14959
|
+
declare function isObjectKey(val: unknown): val is ObjectKey;
|
|
14960
|
+
|
|
14932
14961
|
/**
|
|
14933
14962
|
* **maybePhoneNumber**`(val)`
|
|
14934
14963
|
*
|
|
@@ -15950,4 +15979,4 @@ declare function isVueRef(val: unknown): val is VueRef;
|
|
|
15950
15979
|
*/
|
|
15951
15980
|
declare function asVueRef<T extends Narrowable>(value: T): VueRef<T>;
|
|
15952
15981
|
|
|
15953
|
-
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, hasHtml, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasValidHtml, 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, isHtml, isHtmlComponentTag, 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, isValidAtomicTag, isValidBlockTag, isValidHtml, isValidHtmlTag, 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, validHtmlAttributes, valuesOf, widen, withDefaults, withKeys, withValue, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
|
|
15982
|
+
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 MapOverArray, type MapOverObject, type MapOverObjectToArray, 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, hasHtml, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasValidHtml, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifEqual, 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, isHtml, isHtmlComponentTag, 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, isObjectKey, 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, isValidAtomicTag, isValidBlockTag, isValidHtml, isValidHtmlTag, 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, mapOver, 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, validHtmlAttributes, valuesOf, widen, withDefaults, withKeys, withValue, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
|
|
@@ -2175,6 +2175,19 @@ function ifContainer(value, ifContainer2, notContainer) {
|
|
|
2175
2175
|
return isObject(value) || isArray(value) ? ifContainer2(value) : notContainer(value);
|
|
2176
2176
|
}
|
|
2177
2177
|
|
|
2178
|
+
// src/boolean-logic/ifEqual.ts
|
|
2179
|
+
import { log } from "node:console";
|
|
2180
|
+
function ifEqual(comparator) {
|
|
2181
|
+
return (val, ifTrue2, ifFalse2 = (v) => v) => {
|
|
2182
|
+
log({ val, comparator });
|
|
2183
|
+
if (JSON.stringify(comparator) === JSON.stringify(val)) {
|
|
2184
|
+
return ifTrue2(val);
|
|
2185
|
+
} else {
|
|
2186
|
+
return ifFalse2(val);
|
|
2187
|
+
}
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2178
2191
|
// src/boolean-logic/ifFalse.ts
|
|
2179
2192
|
function ifFalse(val, ifVal, elseVal) {
|
|
2180
2193
|
return isFalse(val) ? ifVal : elseVal;
|
|
@@ -3714,7 +3727,7 @@ function isDefined(value) {
|
|
|
3714
3727
|
|
|
3715
3728
|
// src/type-guards/isDoneFn.ts
|
|
3716
3729
|
function isDoneFn(val) {
|
|
3717
|
-
return
|
|
3730
|
+
return isObject(val) && "done" in val && typeof val.done === "function";
|
|
3718
3731
|
}
|
|
3719
3732
|
|
|
3720
3733
|
// src/type-guards/isEmail.ts
|
|
@@ -3797,6 +3810,16 @@ function isNull(value) {
|
|
|
3797
3810
|
return value === null;
|
|
3798
3811
|
}
|
|
3799
3812
|
|
|
3813
|
+
// src/type-guards/isSymbol.ts
|
|
3814
|
+
function isSymbol(value) {
|
|
3815
|
+
return typeof value === "symbol";
|
|
3816
|
+
}
|
|
3817
|
+
|
|
3818
|
+
// src/type-guards/isObjectKey.ts
|
|
3819
|
+
function isObjectKey(val) {
|
|
3820
|
+
return isString(val) || isSymbol(val);
|
|
3821
|
+
}
|
|
3822
|
+
|
|
3800
3823
|
// src/type-guards/isPhoneNumber.ts
|
|
3801
3824
|
function maybePhoneNumber(val) {
|
|
3802
3825
|
const svelte = String(val).trim();
|
|
@@ -3874,11 +3897,6 @@ function isLikeRegExp(val) {
|
|
|
3874
3897
|
return false;
|
|
3875
3898
|
}
|
|
3876
3899
|
|
|
3877
|
-
// src/type-guards/isSymbol.ts
|
|
3878
|
-
function isSymbol(value) {
|
|
3879
|
-
return typeof value === "symbol";
|
|
3880
|
-
}
|
|
3881
|
-
|
|
3882
3900
|
// src/type-guards/isScalar.ts
|
|
3883
3901
|
function isScalar(value) {
|
|
3884
3902
|
return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
|
|
@@ -4794,6 +4812,29 @@ function logicalReturns(conditions) {
|
|
|
4794
4812
|
);
|
|
4795
4813
|
}
|
|
4796
4814
|
|
|
4815
|
+
// src/lists/mapOver.ts
|
|
4816
|
+
function mapOver(input, toArray = false) {
|
|
4817
|
+
const kind = {
|
|
4818
|
+
kind: Array.isArray(input) ? "MapOverArray" : isObject(input) && isTrue(toArray) ? "MapOverObjectToArray" : isObject(input) ? "MapOverObject" : Never
|
|
4819
|
+
};
|
|
4820
|
+
const fn2 = (cb) => {
|
|
4821
|
+
let output = isTrue(toArray) ? [] : isArray(input) ? [] : {};
|
|
4822
|
+
const kvs = isObject(input) ? toKeyValue(input) : input;
|
|
4823
|
+
for (const kv of kvs) {
|
|
4824
|
+
if (isObject(output) && isObject(input)) {
|
|
4825
|
+
output = {
|
|
4826
|
+
...output,
|
|
4827
|
+
[kv.key]: cb(kv)
|
|
4828
|
+
};
|
|
4829
|
+
} else if (isArray(output)) {
|
|
4830
|
+
output.push(cb(kv));
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
return output;
|
|
4834
|
+
};
|
|
4835
|
+
return createFnWithProps(fn2, kind);
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4797
4838
|
// src/lists/reverse.ts
|
|
4798
4839
|
function reverse(list2) {
|
|
4799
4840
|
return [...list2].reverse();
|
|
@@ -6134,6 +6175,7 @@ export {
|
|
|
6134
6175
|
ifChar,
|
|
6135
6176
|
ifContainer,
|
|
6136
6177
|
ifDefined,
|
|
6178
|
+
ifEqual,
|
|
6137
6179
|
ifFalse,
|
|
6138
6180
|
ifFunction,
|
|
6139
6181
|
ifHasKey,
|
|
@@ -6292,6 +6334,7 @@ export {
|
|
|
6292
6334
|
isNumericArray,
|
|
6293
6335
|
isNumericString,
|
|
6294
6336
|
isObject,
|
|
6337
|
+
isObjectKey,
|
|
6295
6338
|
isObjectToken,
|
|
6296
6339
|
isOptionalParamFunction,
|
|
6297
6340
|
isPhoneNumber,
|
|
@@ -6427,6 +6470,7 @@ export {
|
|
|
6427
6470
|
lookupCountryCode,
|
|
6428
6471
|
lookupCountryName,
|
|
6429
6472
|
lowercase,
|
|
6473
|
+
mapOver,
|
|
6430
6474
|
maybePhoneNumber,
|
|
6431
6475
|
mergeObjects,
|
|
6432
6476
|
mergeScalars,
|