@ts-utilities/core 1.0.1 → 1.0.2

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.
@@ -91,8 +91,8 @@ type TMerged<T> = [T] extends [Array<any>] ? { [K in keyof T]: TMerged<T[K]> } :
91
91
  * const composed = deepmerge(log1, log2, { functionMerge: 'compose' });
92
92
  * composed(); // logs 'first' then 'second'
93
93
  */
94
- declare function deepmerge<T extends Record<string, any>, S$1 extends Record<string, any>[]>(target: T, ...sources: S$1): TMerged<T | S$1[number]>;
95
- declare function deepmerge<T extends Record<string, any>, S$1 extends Record<string, any>[]>(target: T, sources: S$1, options?: DeepMergeOptions): TMerged<T | S$1[number]>;
94
+ declare function deepmerge<T extends Record<string, any>, S extends Record<string, any>[]>(target: T, ...sources: S): TMerged<T | S[number]>;
95
+ declare function deepmerge<T extends Record<string, any>, S extends Record<string, any>[]>(target: T, sources: S, options?: DeepMergeOptions): TMerged<T | S[number]>;
96
96
  //#endregion
97
97
  //#region src/functions/hydrate.d.ts
98
98
  type Hydrate<T> = T extends null ? undefined : T extends (infer U)[] ? Hydrate<U>[] : T extends object ? { [K in keyof T]: Hydrate<T[K]> } : T;
@@ -147,7 +147,7 @@ declare function hydrate<T>(data: T): Hydrate<T>;
147
147
  * Type representing a path split into segments
148
148
  * @template S - The original path string type
149
149
  */
150
- type SplitPath<S$1 extends string> = S$1 extends `${infer First}.${infer Rest}` ? [First, ...SplitPath<Rest>] : [S$1];
150
+ type SplitPath<S extends string> = S extends `${infer First}.${infer Rest}` ? [First, ...SplitPath<Rest>] : [S];
151
151
  /**
152
152
  * Recursive type to resolve nested object types based on path
153
153
  * @template T - Current object type
@@ -193,7 +193,7 @@ declare function getObjectValue<T, K$1 extends Array<string | number>>(obj: T, p
193
193
  * @example
194
194
  * getObjectValue({a: [{b: 1}]}, 'a.0.b', 2) // 1
195
195
  */
196
- declare function getObjectValue<T, S$1 extends string, D>(obj: T, path: S$1, defaultValue: D): Exclude<GetValue<T, SplitPath<S$1>>, undefined> | D;
196
+ declare function getObjectValue<T, S extends string, D>(obj: T, path: S, defaultValue: D): Exclude<GetValue<T, SplitPath<S>>, undefined> | D;
197
197
  /**
198
198
  * Get a nested value from an object using dot notation path
199
199
  * @template T - Object type
@@ -205,7 +205,7 @@ declare function getObjectValue<T, S$1 extends string, D>(obj: T, path: S$1, def
205
205
  * @example
206
206
  * getObjectValue({a: [{b: 1}]}, 'a.0.b') // 1
207
207
  */
208
- declare function getObjectValue<T, S$1 extends string>(obj: T, path: S$1): GetValue<T, SplitPath<S$1>> | undefined;
208
+ declare function getObjectValue<T, S extends string>(obj: T, path: S): GetValue<T, SplitPath<S>> | undefined;
209
209
  /**
210
210
  * Extend an object or function with additional properties while
211
211
  * preserving the original type information.
@@ -496,8 +496,8 @@ declare const convertToSlug: (str: string) => string;
496
496
  * @returns - A Promise that resolves after the specified time or when aborted
497
497
  */
498
498
  declare const sleep: (time?: number, signal?: AbortSignal) => Promise<void>;
499
- type DebouncedFunction<F$1 extends (...args: any[]) => any> = {
500
- (...args: Parameters<F$1>): ReturnType<F$1> | undefined;
499
+ type DebouncedFunction<F extends (...args: any[]) => any> = {
500
+ (...args: Parameters<F>): ReturnType<F> | undefined;
501
501
  readonly isPending: boolean;
502
502
  };
503
503
  /**
@@ -543,11 +543,11 @@ type DebouncedFunction<F$1 extends (...args: any[]) => any> = {
543
543
  * }
544
544
  * ```
545
545
  */
546
- declare function debounce<F$1 extends (...args: any[]) => any>(function_: F$1, wait?: number, options?: {
546
+ declare function debounce<F extends (...args: any[]) => any>(function_: F, wait?: number, options?: {
547
547
  immediate: boolean;
548
- }): DebouncedFunction<F$1>;
549
- type ThrottledFunction<F$1 extends (...args: any[]) => any> = {
550
- (...args: Parameters<F$1>): ReturnType<F$1> | undefined;
548
+ }): DebouncedFunction<F>;
549
+ type ThrottledFunction<F extends (...args: any[]) => any> = {
550
+ (...args: Parameters<F>): ReturnType<F> | undefined;
551
551
  readonly isPending: boolean;
552
552
  };
553
553
  /**
@@ -600,10 +600,10 @@ type ThrottledFunction<F$1 extends (...args: any[]) => any> = {
600
600
  * // After 200ms: executes again if called during window
601
601
  * ```
602
602
  */
603
- declare function throttle<F$1 extends (...args: any[]) => any>(function_: F$1, wait?: number, options?: {
603
+ declare function throttle<F extends (...args: any[]) => any>(function_: F, wait?: number, options?: {
604
604
  leading?: boolean;
605
605
  trailing?: boolean;
606
- }): ThrottledFunction<F$1>;
606
+ }): ThrottledFunction<F>;
607
607
  /**
608
608
  * Formats a string by replacing each '%s' placeholder with the corresponding argument.
609
609
  *
@@ -676,613 +676,4 @@ declare function normalizeText(str?: string | null, options?: {
676
676
  removeNonAlphanumeric?: boolean;
677
677
  }): string;
678
678
  //#endregion
679
- //#region src/types/utilities.d.ts
680
- /**
681
- * Extracts the keys of an object type as a union type.
682
- *
683
- * @template T - The object type to extract keys from
684
- * @returns A union of all keys in the object type
685
- *
686
- * @example
687
- * ```ts
688
- * type User = { name: string; age: number };
689
- * type UserKeys = Keys<User>; // 'name' | 'age'
690
- * ```
691
- */
692
- type Keys<T extends object> = keyof T;
693
- /**
694
- * Extracts the values of an object type as a union type.
695
- *
696
- * @template T - The object type to extract values from
697
- * @returns A union of all values in the object type
698
- *
699
- * @example
700
- * ```ts
701
- * type User = { name: string; age: number };
702
- * type UserValues = Values<User>; // string | number
703
- * ```
704
- */
705
- type Values<T extends object> = T[keyof T];
706
- /**
707
- * Makes all properties of an object type optional recursively.
708
- *
709
- * This type traverses through nested objects and arrays, making all properties optional.
710
- * Functions and primitives are left unchanged.
711
- *
712
- * @template T - The type to make deeply partial
713
- * @returns A type with all properties optional recursively
714
- *
715
- * @example
716
- * ```ts
717
- * type Config = {
718
- * server: { host: string; port: number };
719
- * features: string[];
720
- * };
721
- *
722
- * type PartialConfig = DeepPartial<Config>;
723
- * // {
724
- * // server?: { host?: string; port?: number };
725
- * // features?: string[];
726
- * // }
727
- * ```
728
- */
729
- type DeepPartial<T> = T extends Function ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
730
- /**
731
- * Makes only specified properties of an object type optional.
732
- *
733
- * @template T - The base object type
734
- * @template K - The keys to make optional
735
- * @returns An object type with specified properties optional
736
- *
737
- * @example
738
- * ```ts
739
- * type User = { name: string; age: number; email: string };
740
- * type PartialUser = SelectivePartial<User, 'age' | 'email'>;
741
- * // { name: string; age?: number; email?: string }
742
- * ```
743
- */
744
- type SelectivePartial<T, K$1 extends keyof T> = Omit<T, K$1> & Partial<Pick<T, K$1>>;
745
- /**
746
- * Makes all properties of an object type required recursively.
747
- *
748
- * This type traverses through nested objects and arrays, making all properties required.
749
- * Functions and primitives are left unchanged.
750
- *
751
- * @template T - The type to make deeply required
752
- * @returns A type with all properties required recursively
753
- *
754
- * @example
755
- * ```ts
756
- * type PartialConfig = {
757
- * server?: { host?: string; port?: number };
758
- * };
759
- *
760
- * type RequiredConfig = DeepRequired<PartialConfig>;
761
- * // {
762
- * // server: { host: string; port: number };
763
- * // }
764
- * ```
765
- */
766
- type DeepRequired<T> = T extends Function ? T : T extends Array<infer U> ? Array<DeepRequired<U>> : T extends object ? { [K in keyof T]-?: DeepRequired<T[K]> } : T;
767
- /**
768
- * Makes only specified properties of an object type required.
769
- *
770
- * @template T - The base object type
771
- * @template K - The keys to make required
772
- * @returns An object type with specified properties required
773
- *
774
- * @example
775
- * ```ts
776
- * type PartialUser = { name?: string; age?: number; email?: string };
777
- * type RequiredUser = SelectiveRequired<PartialUser, 'name'>;
778
- * // { name: string; age?: number; email?: string }
779
- * ```
780
- */
781
- type SelectiveRequired<T, K$1 extends keyof T> = Omit<T, K$1> & Required<Pick<T, K$1>>;
782
- /**
783
- * Creates a type where all properties are never (useful for excluding types).
784
- *
785
- * This can be used to create mutually exclusive types or to exclude certain properties.
786
- *
787
- * @template T - The object type to transform
788
- * @returns An object type with all properties set to never
789
- *
790
- * @example
791
- * ```ts
792
- * type User = { name: string; age: number };
793
- * type ExcludedUser = Never<User>; // { name: never; age: never }
794
- * ```
795
- */
796
- type Never<T> = { [K in keyof T]: never };
797
- /**
798
- * Makes all properties of an object type nullable recursively.
799
- *
800
- * @template T - The type to make nullable
801
- * @returns A type where all properties can be null
802
- *
803
- * @example
804
- * ```ts
805
- * type User = { name: string; profile: { age: number } };
806
- * type NullableUser = Nullable<User>;
807
- * // { name: string | null; profile: { age: number | null } | null }
808
- * ```
809
- */
810
- type Nullable<T> = T extends object ? { [P in keyof T]: Nullable<T[P]> } : T | null;
811
- /**
812
- * Makes all properties of an object type optional (undefined) recursively.
813
- *
814
- * @template T - The type to make optional
815
- * @returns A type where all properties can be undefined
816
- *
817
- * @example
818
- * ```ts
819
- * type User = { name: string; profile: { age: number } };
820
- * type OptionalUser = Optional<User>;
821
- * // { name: string | undefined; profile: { age: number | undefined } | undefined }
822
- * ```
823
- */
824
- type Optional<T> = T extends object ? { [P in keyof T]: Optional<T[P]> } : T | undefined;
825
- /**
826
- * Makes all properties of an object type nullish (null or undefined) recursively.
827
- *
828
- * @template T - The type to make nullish
829
- * @returns A type where all properties can be null or undefined
830
- *
831
- * @example
832
- * ```ts
833
- * type User = { name: string; profile: { age: number } };
834
- * type NullishUser = Nullish<User>;
835
- * // { name: string | null | undefined; profile: { age: number | null | undefined } | null | undefined }
836
- * ```
837
- */
838
- type Nullish<T> = T extends object ? { [P in keyof T]: Nullish<T[P]> } : T | null | undefined;
839
- /**
840
- * Makes all properties of an object type optional and nullish recursively.
841
- *
842
- * This combines optional properties with nullish values.
843
- *
844
- * @template T - The type to make maybe
845
- * @returns A type where all properties are optional and can be null or undefined
846
- *
847
- * @example
848
- * ```ts
849
- * type User = { name: string; profile: { age: number } };
850
- * type MaybeUser = Maybe<User>;
851
- * // { name?: string | null | undefined; profile?: { age?: number | null | undefined } | null | undefined }
852
- * ```
853
- */
854
- type Maybe<T> = T extends object ? { [P in keyof T]?: Nullish<T[P]> } : T | null | undefined;
855
- /**
856
- * Makes all properties of an object type readonly recursively.
857
- *
858
- * This type traverses through nested objects and arrays, making all properties readonly.
859
- * Functions and primitives are left unchanged.
860
- *
861
- * @template T - The type to make deeply readonly
862
- * @returns A type with all properties readonly recursively
863
- *
864
- * @example
865
- * ```ts
866
- * type Config = {
867
- * server: { host: string; port: number };
868
- * features: string[];
869
- * };
870
- *
871
- * type ReadonlyConfig = DeepReadonly<Config>;
872
- * // {
873
- * // readonly server: { readonly host: string; readonly port: number };
874
- * // readonly features: readonly string[];
875
- * // }
876
- * ```
877
- */
878
- type DeepReadonly<T> = T extends Function ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
879
- /**
880
- * Removes readonly modifier from all properties of an object type recursively.
881
- *
882
- * @template T - The readonly type to make mutable
883
- * @returns A type with all readonly modifiers removed
884
- *
885
- * @example
886
- * ```ts
887
- * type ReadonlyUser = { readonly name: string; readonly profile: { readonly age: number } };
888
- * type MutableUser = Mutable<ReadonlyUser>;
889
- * // { name: string; profile: { age: number } }
890
- * ```
891
- */
892
- type Mutable<T> = { -readonly [P in keyof T]: T[P] };
893
- /**
894
- * Extracts keys of an object type that have values of a specific type.
895
- *
896
- * @template T - The object type to search
897
- * @template U - The value type to match
898
- * @returns A union of keys whose values match the specified type
899
- *
900
- * @example
901
- * ```ts
902
- * type User = { name: string; age: number; active: boolean };
903
- * type StringKeys = KeysOfType<User, string>; // 'name'
904
- * type NumberKeys = KeysOfType<User, number>; // 'age'
905
- * ```
906
- */
907
- type KeysOfType<T, U$1> = { [K in keyof T]: T[K] extends U$1 ? K : never }[keyof T];
908
- /**
909
- * Omits properties from an object type that have values of a specific type.
910
- *
911
- * @template T - The object type to filter
912
- * @template U - The value type to exclude
913
- * @returns An object type without properties of the specified value type
914
- *
915
- * @example
916
- * ```ts
917
- * type Mixed = { name: string; age: number; active: boolean };
918
- * type WithoutStrings = OmitByType<Mixed, string>; // { age: number; active: boolean }
919
- * ```
920
- */
921
- type OmitByType<T, U$1> = { [K in keyof T as T[K] extends U$1 ? never : K]: T[K] };
922
- /**
923
- * Makes specified properties required while keeping others as-is.
924
- *
925
- * @template T - The base object type
926
- * @template K - The keys to make required
927
- * @returns An object type with specified properties required
928
- *
929
- * @example
930
- * ```ts
931
- * type PartialUser = { name?: string; age?: number; email?: string };
932
- * type RequiredNameUser = RequiredKeys<PartialUser, 'name'>;
933
- * // { name: string; age?: number; email?: string }
934
- * ```
935
- */
936
- type RequiredKeys<T, K$1 extends keyof T> = Omit<T, K$1> & Required<Pick<T, K$1>>;
937
- /**
938
- * Computes the symmetric difference between two object types.
939
- *
940
- * Properties that exist in either T or U but not in both.
941
- *
942
- * @template T - First object type
943
- * @template U - Second object type
944
- * @returns Properties unique to T or U
945
- *
946
- * @example
947
- * ```ts
948
- * type A = { x: number; y: string };
949
- * type B = { y: string; z: boolean };
950
- * type DiffAB = Diff<A, B>; // { x: number; z: boolean }
951
- * ```
952
- */
953
- type Diff<T, U$1> = Omit<T, keyof U$1> & Omit<U$1, keyof T>;
954
- /**
955
- * Computes the intersection of two object types (properties present in both).
956
- *
957
- * @template T - First object type
958
- * @template U - Second object type
959
- * @returns Properties that exist in both T and U
960
- *
961
- * @example
962
- * ```ts
963
- * type A = { x: number; y: string };
964
- * type B = { y: string; z: boolean };
965
- * type IntersectionAB = Intersection<A, B>; // { y: string }
966
- * ```
967
- */
968
- type Intersection<T extends object, U$1 extends object> = Pick<T, Extract<keyof T, keyof U$1> & Extract<keyof U$1, keyof T>>;
969
- /**
970
- * Merges two object types, combining their properties.
971
- *
972
- * @template T - First object type
973
- * @template U - Second object type
974
- * @returns A merged object type with properties from both
975
- *
976
- * @example
977
- * ```ts
978
- * type A = { x: number; y: string };
979
- * type B = { y: boolean; z: string };
980
- * type Merged = Merge<A, B>; // { x: number; y: boolean; z: string }
981
- * ```
982
- */
983
- type Merge<T extends object, U$1 extends object, I = Diff<T, U$1> & Intersection<U$1, T> & Diff<U$1, T>> = Pick<I, keyof I>;
984
- /**
985
- * Subtracts properties of one object type from another.
986
- *
987
- * @template T - The object type to subtract from
988
- * @template U - The object type whose properties to subtract
989
- * @returns T without properties that exist in U
990
- *
991
- * @example
992
- * ```ts
993
- * type A = { x: number; y: string; z: boolean };
994
- * type B = { y: string };
995
- * type Subtracted = Substract<A, B>; // { x: number; z: boolean }
996
- * ```
997
- */
998
- type Substract<T extends object, U$1 extends object> = Omit<T, keyof U$1>;
999
- /**
1000
- * Represents either all properties present or none of them.
1001
- *
1002
- * Useful for creating mutually exclusive configurations.
1003
- *
1004
- * @template T - The object type
1005
- * @returns Either the full object or an empty object with optional properties
1006
- *
1007
- * @example
1008
- * ```ts
1009
- * type Config = { host: string; port: number };
1010
- * type AllOrNoneConfig = AllOrNone<Config>;
1011
- * // { host: string; port: number } | {}
1012
- * ```
1013
- */
1014
- type AllOrNone<T> = T | { [P in keyof T]?: never };
1015
- /**
1016
- * Represents exactly one property from an object type being present.
1017
- *
1018
- * Useful for creating discriminated unions or mutually exclusive options.
1019
- *
1020
- * @template T - The object type
1021
- * @returns A union where only one property is present at a time
1022
- *
1023
- * @example
1024
- * ```ts
1025
- * type Action = { type: 'create'; payload: string } | { type: 'update'; id: number };
1026
- * type OneAction = OneOf<Action>;
1027
- * // { type: 'create'; payload: string } | { type: 'update'; id: number }
1028
- * ```
1029
- */
1030
- type OneOf<T> = { [K in keyof T]: Pick<T, K> }[keyof T];
1031
- /**
1032
- * Represents exactly two properties from an object type being present.
1033
- *
1034
- * @template T - The object type
1035
- * @returns A union where exactly two properties are present at a time
1036
- *
1037
- * @example
1038
- * ```ts
1039
- * type Config = { a: number; b: string; c: boolean };
1040
- * type TwoConfig = TwoOf<Config>;
1041
- * // { a: number; b: string } | { a: number; c: boolean } | { b: string; c: boolean }
1042
- * ```
1043
- */
1044
- type TwoOf<T> = { [K in keyof T]: { [L in Exclude<keyof T, K>]: Pick<T, K | L> }[Exclude<keyof T, K>] }[keyof T];
1045
- /**
1046
- * Prettifies a complex type by expanding it for better readability in tooltips.
1047
- *
1048
- * This type doesn't change the runtime type but helps with IntelliSense display.
1049
- *
1050
- * @template T - The type to prettify
1051
- * @returns The same type but expanded for better readability
1052
- *
1053
- * @example
1054
- * ```ts
1055
- * type Complex = { a: string } & { b: number };
1056
- * type PrettyComplex = Prettify<Complex>; // Shows as { a: string; b: number }
1057
- * ```
1058
- */
1059
- type Prettify<T> = T extends infer U ? U extends object ? { [K in keyof U]: U[K] } & {} : U : never;
1060
- /**
1061
- * Extracts all nested keys of an object type as dot-separated strings.
1062
- *
1063
- * @template ObjectType - The object type to extract nested keys from
1064
- * @template IgnoreKeys - Keys to ignore during extraction
1065
- * @returns A union of dot-separated string paths
1066
- *
1067
- * @example
1068
- * ```ts
1069
- * type User = {
1070
- * name: string;
1071
- * profile: { age: number; address: { city: string } };
1072
- * tags: string[];
1073
- * };
1074
- *
1075
- * type UserPaths = NestedKeyOf<User>;
1076
- * // 'name' | 'profile' | 'profile.age' | 'profile.address' | 'profile.address.city' | 'tags'
1077
- * ```
1078
- */
1079
- type NestedKeyOf<ObjectType extends object, IgnoreKeys extends string = never> = { [Key in keyof ObjectType & string]: Key extends IgnoreKeys ? never : ObjectType[Key] extends object ? ObjectType[Key] extends Array<any> ? Key : `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key], IgnoreKeys>}` : `${Key}` }[keyof ObjectType & string];
1080
- /**
1081
- * Creates a type that excludes properties present in another type.
1082
- *
1083
- * This is useful for creating mutually exclusive types.
1084
- *
1085
- * @template T - The base type
1086
- * @template U - The type whose properties to exclude
1087
- * @returns A type with properties from T that are not in U
1088
- *
1089
- * @example
1090
- * ```ts
1091
- * type A = { x: number; y: string };
1092
- * type B = { y: string };
1093
- * type WithoutB = Without<A, B>; // { x?: never }
1094
- * ```
1095
- */
1096
- type Without<T, U$1> = { [P in Exclude<keyof T, keyof U$1>]?: never };
1097
- //#endregion
1098
- //#region src/types/gates.d.ts
1099
- type BUFFER<T> = T;
1100
- type IMPLIES<T, U$1> = T extends U$1 ? true : false;
1101
- type XOR_Binary<T, U$1> = T | U$1 extends object ? (Without<T, U$1> & U$1) | (Without<U$1, T> & T) : T | U$1;
1102
- type XNOR_Binary<T, U$1> = (T & U$1) | (Without<T, U$1> & Without<U$1, T>);
1103
- /**
1104
- * Computes a type-level AND (all must true) for a tuple of types.
1105
- *
1106
- * Truth table for 3 arguments:
1107
- *
1108
- * A B C = AND
1109
- * 1 1 1 = 1
1110
- * 1 1 0 = 0
1111
- * 1 0 1 = 0
1112
- * 1 0 0 = 0
1113
- * 0 1 1 = 0
1114
- * 0 1 0 = 0
1115
- * 0 0 1 = 0
1116
- * 0 0 0 = 0
1117
- *
1118
- * @template T - Tuple of boolean-like types (1/0)
1119
- */
1120
- type AND<T extends any[]> = T extends [infer F, ...infer R] ? R extends any[] ? F & AND<R> : F : unknown;
1121
- /**
1122
- * Computes a type-level OR (At least one) for a tuple of types.
1123
- *
1124
- * Truth table for 3 arguments:
1125
- *
1126
- * A B C = OR
1127
- * 1 1 1 = 1
1128
- * 1 1 0 = 1
1129
- * 1 0 1 = 1
1130
- * 1 0 0 = 1
1131
- * 0 1 1 = 1
1132
- * 0 1 0 = 1
1133
- * 0 0 1 = 1
1134
- * 0 0 0 = 0
1135
- *
1136
- * @template T - Tuple of boolean-like types (1/0)
1137
- */
1138
- type OR<T extends any[]> = T extends [infer F, ...infer R] ? R extends any[] ? F | OR<R> : F : never;
1139
- /**
1140
- * Computes a type-level XOR (only one/odd) for a tuple of types.
1141
- *
1142
- * Truth table for 3 arguments:
1143
- *
1144
- * A B C = XOR
1145
- * 1 1 1 = 1
1146
- * 1 1 0 = 0
1147
- * 1 0 1 = 0
1148
- * 1 0 0 = 1
1149
- * 0 1 1 = 0
1150
- * 0 1 0 = 1
1151
- * 0 0 1 = 1
1152
- * 0 0 0 = 0
1153
- *
1154
- * @template T - Tuple of boolean-like types (1/0)
1155
- */
1156
- type XOR<T extends any[]> = T extends [infer F, ...infer R] ? R extends [infer S, ...infer Rest] ? XOR<[XOR_Binary<F, S>, ...Rest]> : F : never;
1157
- /**
1158
- * Computes a type-level XNOR (All or None true) for a tuple of types.
1159
- *
1160
- * Truth table for 3 arguments:
1161
- *
1162
- * A B C = XNOR
1163
- * 1 1 1 = 0
1164
- * 1 1 0 = 1
1165
- * 1 0 1 = 1
1166
- * 1 0 0 = 0
1167
- * 0 1 1 = 1
1168
- * 0 1 0 = 0
1169
- * 0 0 1 = 0
1170
- * 0 0 0 = 1
1171
- *
1172
- * @template T - Tuple of boolean-like types (1/0)
1173
- */
1174
- type XNOR<T extends any[]> = T extends [infer F, ...infer R] ? R extends [infer S, ...infer Rest] ? XNOR<[XNOR_Binary<F, S>, ...Rest]> : F : never;
1175
- /**
1176
- * Computes a type-level NOT for a tuple of types.
1177
- *
1178
- * Truth table for 3 arguments:
1179
- *
1180
- * A B C = NOT
1181
- * 1 1 1 = 0
1182
- * 1 1 0 = 0
1183
- * 1 0 1 = 0
1184
- * 1 0 0 = 0
1185
- * 0 1 1 = 0
1186
- * 0 1 0 = 0
1187
- * 0 0 1 = 0
1188
- * 0 0 0 = 1
1189
- *
1190
- * @template T - Tuple of boolean-like types (1/0)
1191
- */
1192
- type NOT<T> = { [P in keyof T]?: never };
1193
- /**
1194
- * Computes a type-level NAND for a tuple of types.
1195
- *
1196
- * Truth table for 3 arguments:
1197
- *
1198
- * A B C = NAND
1199
- * 1 1 1 = 0
1200
- * 1 1 0 = 1
1201
- * 1 0 1 = 1
1202
- * 1 0 0 = 1
1203
- * 0 1 1 = 1
1204
- * 0 1 0 = 1
1205
- * 0 0 1 = 1
1206
- * 0 0 0 = 1
1207
- *
1208
- * @template T - Tuple of boolean-like types (1/0)
1209
- */
1210
- type NAND<T extends any[]> = NOT<AND<T>>;
1211
- /**
1212
- * Computes a type-level NOR for a tuple of types.
1213
- *
1214
- * Truth table for 3 arguments:
1215
- *
1216
- * A B C = NOR
1217
- * 1 1 1 = 0
1218
- * 1 1 0 = 0
1219
- * 1 0 1 = 0
1220
- * 1 0 0 = 0
1221
- * 0 1 1 = 0
1222
- * 0 1 0 = 0
1223
- * 0 0 1 = 0
1224
- * 0 0 0 = 1
1225
- *
1226
- * @template T - Tuple of boolean-like types (1/0)
1227
- */
1228
- type NOR<T extends any[]> = NOT<OR<T>>;
1229
- //#endregion
1230
- //#region src/types/guards.d.ts
1231
- /**
1232
- * Represents primitive JavaScript types including null and undefined.
1233
- */
1234
- type Primitive = string | number | bigint | boolean | symbol | null | undefined;
1235
- /**
1236
- * Represents all falsy values in JavaScript.
1237
- */
1238
- type Falsy = false | '' | 0 | null | undefined;
1239
- /**
1240
- * Type guard that checks if a value is falsy.
1241
- *
1242
- * @param val - The value to check
1243
- * @returns True if the value is falsy, false otherwise
1244
- *
1245
- * @example
1246
- * if (isFalsy(value)) {
1247
- * console.log('Value is falsy');
1248
- * }
1249
- */
1250
- declare const isFalsy: (val: unknown) => val is Falsy;
1251
- /**
1252
- * Type guard that checks if a value is null or undefined.
1253
- *
1254
- * @param val - The value to check
1255
- * @returns True if the value is null or undefined, false otherwise
1256
- *
1257
- * @example
1258
- * if (isNullish(value)) {
1259
- * console.log('Value is null or undefined');
1260
- * }
1261
- */
1262
- declare const isNullish: (val: unknown) => val is null | undefined;
1263
- /**
1264
- * Type guard that checks if a value is a primitive type.
1265
- *
1266
- * @param val - The value to check
1267
- * @returns True if the value is a primitive, false otherwise
1268
- *
1269
- * @example
1270
- * if (isPrimitive(value)) {
1271
- * console.log('Value is a primitive type');
1272
- * }
1273
- */
1274
- declare const isPrimitive: (val: unknown) => val is Primitive;
1275
- /**
1276
- * Type guard that checks if a value is a plain object (not an array, function, etc.).
1277
- *
1278
- * @param value - The value to check
1279
- * @returns True if the value is a plain object, false otherwise
1280
- *
1281
- * @example
1282
- * if (isPlainObject(value)) {
1283
- * console.log('Value is a plain object');
1284
- * }
1285
- */
1286
- declare function isPlainObject(value: unknown): value is Record<string, any>;
1287
- //#endregion
1288
- export { AND, AllOrNone, BUFFER, DeepMergeOptions, DeepPartial, DeepReadonly, DeepRequired, Diff, Falsy, IMPLIES, Intersection, Keys, KeysOfType, Maybe, Merge, Mutable, NAND, NOR, NOT, NestedKeyOf, Never, Nullable, Nullish, OR, OmitByType, OneOf, Optional, Prettify, Primitive, RequiredKeys, ScheduleOpts, SelectivePartial, SelectiveRequired, Substract, Task, TwoOf, Values, Without, XNOR, XNOR_Binary, XOR, XOR_Binary, convertToNormalCase, convertToSlug, debounce, deepmerge, escapeRegExp, extendProps, getObjectValue, hydrate, isFalsy, isNullish, isPlainObject, isPrimitive, normalizeText, poll, printf, schedule, shield, sleep, throttle };
679
+ export { DeepMergeOptions as _, normalizeText as a, throttle as c, Task as d, schedule as f, hydrate as g, getObjectValue as h, escapeRegExp as i, shield as l, extendProps as m, convertToSlug as n, printf as o, poll as p, debounce as r, sleep as s, convertToNormalCase as t, ScheduleOpts as u, deepmerge as v };