@sinclair/typebox 0.32.0-dev-26 → 0.32.0-dev-27
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/build/import/index.d.mts +2 -2
- package/build/import/type/awaited/awaited.mjs +2 -6
- package/build/import/type/composite/composite.d.mts +1 -2
- package/build/import/type/composite/composite.mjs +2 -2
- package/build/import/type/const/const.mjs +6 -6
- package/build/import/type/constructor/constructor.d.mts +1 -1
- package/build/import/type/constructor/constructor.mjs +1 -1
- package/build/import/type/deref/deref.mjs +1 -2
- package/build/import/type/discard/discard.mjs +2 -2
- package/build/import/type/enum/enum.mjs +3 -0
- package/build/import/type/exclude/exclude-from-mapped-result.d.mts +5 -5
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +7 -7
- package/build/import/type/exclude/exclude.mjs +0 -1
- package/build/import/type/extends/extends-from-mapped-key.d.mts +1 -1
- package/build/import/type/extends/extends-from-mapped-key.mjs +4 -5
- package/build/import/type/extends/extends-from-mapped-result.d.mts +5 -5
- package/build/import/type/extends/extends-from-mapped-result.mjs +7 -7
- package/build/import/type/extends/extends.mjs +0 -1
- package/build/import/type/extract/extract-from-mapped-result.d.mts +5 -5
- package/build/import/type/extract/extract-from-mapped-result.mjs +7 -7
- package/build/import/type/extract/extract.d.mts +1 -2
- package/build/import/type/extract/extract.mjs +4 -2
- package/build/import/type/index.d.mts +1 -1
- package/build/import/type/index.mjs +1 -1
- package/build/import/type/indexed/indexed-from-mapped-key.d.mts +2 -2
- package/build/import/type/indexed/indexed-from-mapped-key.mjs +4 -5
- package/build/import/type/indexed/indexed-from-mapped-result.d.mts +1 -1
- package/build/import/type/indexed/indexed-property-keys.d.mts +6 -6
- package/build/import/type/indexed/indexed-property-keys.mjs +3 -5
- package/build/import/type/indexed/indexed.d.mts +1 -1
- package/build/import/type/indexed/indexed.mjs +9 -27
- package/build/import/type/intersect/intersect-evaluated.mjs +3 -13
- package/build/import/type/intrinsic/capitalize.d.mts +2 -2
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.d.mts +1 -1
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +4 -5
- package/build/import/type/intrinsic/intrinsic.d.mts +2 -3
- package/build/import/type/intrinsic/intrinsic.mjs +2 -5
- package/build/import/type/intrinsic/lowercase.d.mts +2 -2
- package/build/import/type/intrinsic/uncapitalize.d.mts +2 -2
- package/build/import/type/intrinsic/uppercase.d.mts +2 -2
- package/build/import/type/iterator/iterator.mjs +1 -1
- package/build/import/type/keyof/keyof-from-mapped-result.d.mts +3 -3
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +4 -4
- package/build/import/type/keyof/keyof-property-keys.d.mts +3 -3
- package/build/import/type/keyof/keyof-property-keys.mjs +9 -15
- package/build/import/type/keyof/keyof.mjs +2 -8
- package/build/import/type/mapped/mapped.d.mts +6 -1
- package/build/import/type/mapped/mapped.mjs +21 -14
- package/build/import/type/not/not.mjs +1 -1
- package/build/import/type/object/object.d.mts +1 -1
- package/build/import/type/object/object.mjs +0 -1
- package/build/import/type/omit/index.d.mts +1 -0
- package/build/import/type/omit/index.mjs +1 -0
- package/build/import/type/omit/omit-from-mapped-key.mjs +4 -5
- package/build/import/type/omit/omit-from-mapped-result.d.mts +11 -0
- package/build/import/type/omit/omit-from-mapped-result.mjs +17 -0
- package/build/import/type/omit/omit.d.mts +6 -3
- package/build/import/type/omit/omit.mjs +11 -9
- package/build/import/type/optional/optional-from-mapped-result.d.mts +5 -5
- package/build/import/type/optional/optional-from-mapped-result.mjs +7 -7
- package/build/import/type/partial/partial-from-mapped-result.d.mts +5 -5
- package/build/import/type/partial/partial-from-mapped-result.mjs +4 -4
- package/build/import/type/partial/partial.d.mts +2 -3
- package/build/import/type/partial/partial.mjs +8 -21
- package/build/import/type/pick/index.d.mts +1 -0
- package/build/import/type/pick/index.mjs +1 -0
- package/build/import/type/pick/pick-from-mapped-key.mjs +4 -5
- package/build/import/type/pick/pick-from-mapped-result.d.mts +11 -0
- package/build/import/type/pick/pick-from-mapped-result.mjs +17 -0
- package/build/import/type/pick/pick.d.mts +5 -2
- package/build/import/type/pick/pick.mjs +11 -10
- package/build/import/type/promise/promise.mjs +1 -1
- package/build/import/type/readonly/readonly-from-mapped-result.d.mts +5 -5
- package/build/import/type/readonly/readonly-from-mapped-result.mjs +4 -4
- package/build/import/type/record/record.d.mts +2 -2
- package/build/import/type/record/record.mjs +3 -0
- package/build/import/type/ref/ref.mjs +1 -1
- package/build/import/type/required/required-from-mapped-result.d.mts +5 -5
- package/build/import/type/required/required-from-mapped-result.mjs +7 -7
- package/build/import/type/required/required.d.mts +2 -3
- package/build/import/type/required/required.mjs +4 -14
- package/build/import/type/rest/rest.d.mts +2 -2
- package/build/import/type/rest/rest.mjs +1 -2
- package/build/import/type/sets/index.d.mts +1 -0
- package/build/import/type/sets/index.mjs +1 -0
- package/build/import/type/sets/set.d.mts +24 -0
- package/build/import/type/sets/set.mjs +35 -0
- package/build/import/type/strict/strict.d.mts +1 -1
- package/build/import/type/strict/strict.mjs +1 -1
- package/build/import/type/template-literal/syntax.d.mts +1 -1
- package/build/import/type/template-literal/template-literal.d.mts +1 -1
- package/build/import/type/transform/transform.mjs +1 -1
- package/build/import/type/type/json.d.mts +6 -2
- package/build/import/type/union/union-evaluated.mjs +3 -14
- package/build/require/index.d.ts +2 -2
- package/build/require/type/awaited/awaited.js +2 -6
- package/build/require/type/composite/composite.d.ts +1 -2
- package/build/require/type/composite/composite.js +5 -6
- package/build/require/type/const/const.js +6 -6
- package/build/require/type/constructor/constructor.d.ts +1 -1
- package/build/require/type/constructor/constructor.js +1 -1
- package/build/require/type/deref/deref.js +0 -1
- package/build/require/type/discard/discard.js +2 -2
- package/build/require/type/enum/enum.js +3 -0
- package/build/require/type/exclude/exclude-from-mapped-result.d.ts +5 -5
- package/build/require/type/exclude/exclude-from-mapped-result.js +7 -7
- package/build/require/type/exclude/exclude.js +0 -1
- package/build/require/type/extends/extends-from-mapped-key.d.ts +1 -1
- package/build/require/type/extends/extends-from-mapped-key.js +4 -5
- package/build/require/type/extends/extends-from-mapped-result.d.ts +5 -5
- package/build/require/type/extends/extends-from-mapped-result.js +7 -7
- package/build/require/type/extends/extends.js +0 -1
- package/build/require/type/extract/extract-from-mapped-result.d.ts +5 -5
- package/build/require/type/extract/extract-from-mapped-result.js +7 -7
- package/build/require/type/extract/extract.d.ts +1 -2
- package/build/require/type/extract/extract.js +4 -3
- package/build/require/type/index.d.ts +1 -1
- package/build/require/type/index.js +1 -1
- package/build/require/type/indexed/indexed-from-mapped-key.d.ts +2 -2
- package/build/require/type/indexed/indexed-from-mapped-key.js +4 -5
- package/build/require/type/indexed/indexed-from-mapped-result.d.ts +1 -1
- package/build/require/type/indexed/indexed-property-keys.d.ts +6 -6
- package/build/require/type/indexed/indexed-property-keys.js +3 -5
- package/build/require/type/indexed/indexed.d.ts +1 -1
- package/build/require/type/indexed/indexed.js +9 -27
- package/build/require/type/intersect/intersect-evaluated.js +3 -13
- package/build/require/type/intrinsic/capitalize.d.ts +2 -2
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.d.ts +1 -1
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +4 -5
- package/build/require/type/intrinsic/intrinsic.d.ts +2 -3
- package/build/require/type/intrinsic/intrinsic.js +2 -5
- package/build/require/type/intrinsic/lowercase.d.ts +2 -2
- package/build/require/type/intrinsic/uncapitalize.d.ts +2 -2
- package/build/require/type/intrinsic/uppercase.d.ts +2 -2
- package/build/require/type/iterator/iterator.js +1 -1
- package/build/require/type/keyof/keyof-from-mapped-result.d.ts +3 -3
- package/build/require/type/keyof/keyof-from-mapped-result.js +4 -4
- package/build/require/type/keyof/keyof-property-keys.d.ts +3 -3
- package/build/require/type/keyof/keyof-property-keys.js +9 -15
- package/build/require/type/keyof/keyof.js +2 -8
- package/build/require/type/mapped/mapped.d.ts +6 -1
- package/build/require/type/mapped/mapped.js +21 -14
- package/build/require/type/not/not.js +1 -1
- package/build/require/type/object/object.d.ts +1 -1
- package/build/require/type/object/object.js +0 -1
- package/build/require/type/omit/index.d.ts +1 -0
- package/build/require/type/omit/index.js +1 -0
- package/build/require/type/omit/omit-from-mapped-key.js +4 -5
- package/build/require/type/omit/omit-from-mapped-result.d.ts +11 -0
- package/build/require/type/omit/omit-from-mapped-result.js +22 -0
- package/build/require/type/omit/omit.d.ts +6 -3
- package/build/require/type/omit/omit.js +10 -8
- package/build/require/type/optional/optional-from-mapped-result.d.ts +5 -5
- package/build/require/type/optional/optional-from-mapped-result.js +7 -7
- package/build/require/type/partial/partial-from-mapped-result.d.ts +5 -5
- package/build/require/type/partial/partial-from-mapped-result.js +4 -4
- package/build/require/type/partial/partial.d.ts +2 -3
- package/build/require/type/partial/partial.js +8 -21
- package/build/require/type/pick/index.d.ts +1 -0
- package/build/require/type/pick/index.js +1 -0
- package/build/require/type/pick/pick-from-mapped-key.js +4 -5
- package/build/require/type/pick/pick-from-mapped-result.d.ts +11 -0
- package/build/require/type/pick/pick-from-mapped-result.js +22 -0
- package/build/require/type/pick/pick.d.ts +5 -2
- package/build/require/type/pick/pick.js +10 -9
- package/build/require/type/promise/promise.js +1 -1
- package/build/require/type/readonly/readonly-from-mapped-result.d.ts +5 -5
- package/build/require/type/readonly/readonly-from-mapped-result.js +4 -4
- package/build/require/type/record/record.d.ts +2 -2
- package/build/require/type/record/record.js +3 -0
- package/build/require/type/ref/ref.js +1 -1
- package/build/require/type/required/required-from-mapped-result.d.ts +5 -5
- package/build/require/type/required/required-from-mapped-result.js +7 -7
- package/build/require/type/required/required.d.ts +2 -3
- package/build/require/type/required/required.js +4 -14
- package/build/require/type/rest/rest.d.ts +2 -2
- package/build/require/type/rest/rest.js +1 -3
- package/build/require/type/sets/index.d.ts +1 -0
- package/build/require/type/{operators → sets}/index.js +1 -1
- package/build/require/type/sets/set.d.ts +24 -0
- package/build/require/type/sets/set.js +47 -0
- package/build/require/type/strict/strict.d.ts +1 -1
- package/build/require/type/strict/strict.js +1 -1
- package/build/require/type/template-literal/parse.js +1 -1
- package/build/require/type/template-literal/syntax.d.ts +1 -1
- package/build/require/type/template-literal/template-literal.d.ts +1 -1
- package/build/require/type/transform/transform.js +1 -1
- package/build/require/type/type/json.d.ts +6 -2
- package/build/require/type/union/union-evaluated.js +3 -14
- package/package.json +1 -1
- package/readme.md +64 -64
- package/build/import/type/operators/index.d.mts +0 -1
- package/build/import/type/operators/index.mjs +0 -1
- package/build/import/type/operators/operators.d.mts +0 -24
- package/build/import/type/operators/operators.mjs +0 -77
- package/build/require/type/operators/index.d.ts +0 -1
- package/build/require/type/operators/operators.d.ts +0 -24
- package/build/require/type/operators/operators.js +0 -89
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type TOperatorIncludes<T extends PropertyKey[], S extends PropertyKey> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : TOperatorIncludes<R, S> : false);
|
|
2
|
-
/** Returns true if element S is in the set of T */
|
|
3
|
-
export declare function OperatorIncludes<T extends PropertyKey[], S extends PropertyKey>(T: [...T], S: S): TOperatorIncludes<T, S>;
|
|
4
|
-
export type TOperatorSubset<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<S, L> extends true ? TOperatorSubset<R, S> : false : true);
|
|
5
|
-
/** Returns true if T is a subset of S */
|
|
6
|
-
export declare function OperatorSubset<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TOperatorSubset<T, S>;
|
|
7
|
-
export type TOperatorDistinct<T extends PropertyKey[], Acc extends PropertyKey[] = []> = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<Acc, L> extends false ? TOperatorDistinct<R, [...Acc, L]> : TOperatorDistinct<R, [...Acc]> : Acc;
|
|
8
|
-
/** Returns a distinct set of elements */
|
|
9
|
-
export declare function OperatorDistinct<T extends PropertyKey[]>(T: [...T], Acc?: PropertyKey[]): TOperatorDistinct<T>;
|
|
10
|
-
export type TOperatorIntersect<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<S, L> extends true ? TOperatorIntersect<R, S, [L, ...Acc]> : TOperatorIntersect<R, S, [...Acc]> : Acc);
|
|
11
|
-
/** Returns the Intersect of the given sets */
|
|
12
|
-
export declare function OperatorIntersect<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TOperatorIntersect<T, S>;
|
|
13
|
-
export type TOperatorUnion<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = S> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorUnion<R, S, [...Acc, L]> : Acc);
|
|
14
|
-
/** Returns the Union of the given sets */
|
|
15
|
-
export declare function OperatorUnion<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S], Acc?: PropertyKey[]): TOperatorUnion<T, S>;
|
|
16
|
-
export type OperatorComplement<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<S, L> extends true ? OperatorComplement<R, S, [...Acc]> : OperatorComplement<R, S, [L, ...Acc]> : Acc);
|
|
17
|
-
/** Returns the Complement by omitting elements in T that are in S */
|
|
18
|
-
export declare function OperatorComplement<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S], Acc?: PropertyKey[]): OperatorComplement<T, S>;
|
|
19
|
-
export type OperatorIntersectMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? OperatorIntersectMany<R, TOperatorIntersect<Acc, L>> : Acc);
|
|
20
|
-
/** Returns the Intersect of multiple sets */
|
|
21
|
-
export declare function OperatorIntersectMany<T extends PropertyKey[][]>(T: [...T], Acc?: PropertyKey[]): OperatorIntersectMany<T>;
|
|
22
|
-
export type OperatorUnionMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? OperatorUnionMany<R, TOperatorUnion<Acc, L>> : Acc);
|
|
23
|
-
/** Returns the Union of multiple sets */
|
|
24
|
-
export declare function OperatorUnionMany<T extends PropertyKey[][]>(T: [...T], Acc?: PropertyKey[]): OperatorUnionMany<T>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/** Returns true if element S is in the set of T */
|
|
2
|
-
// prettier-ignore
|
|
3
|
-
export function OperatorIncludes(T, S) {
|
|
4
|
-
const [L, ...R] = T;
|
|
5
|
-
return (T.length > 0
|
|
6
|
-
? S === L
|
|
7
|
-
? true
|
|
8
|
-
: OperatorIncludes(R, S)
|
|
9
|
-
: false);
|
|
10
|
-
}
|
|
11
|
-
/** Returns true if T is a subset of S */
|
|
12
|
-
export function OperatorSubset(T, S) {
|
|
13
|
-
const [L, ...R] = T;
|
|
14
|
-
// prettier-ignore
|
|
15
|
-
return (T.length > 0
|
|
16
|
-
? OperatorIncludes(S, L) === true
|
|
17
|
-
? OperatorSubset(R, S)
|
|
18
|
-
: false
|
|
19
|
-
: true);
|
|
20
|
-
}
|
|
21
|
-
/** Returns a distinct set of elements */
|
|
22
|
-
export function OperatorDistinct(T, Acc = []) {
|
|
23
|
-
const [L, ...R] = T;
|
|
24
|
-
// prettier-ignore
|
|
25
|
-
return (T.length > 0 ?
|
|
26
|
-
(OperatorIncludes(Acc, L) === false
|
|
27
|
-
? OperatorDistinct(R, [...Acc, L])
|
|
28
|
-
: OperatorDistinct(R, [...Acc])) : Acc);
|
|
29
|
-
}
|
|
30
|
-
/** Returns the Intersect of the given sets */
|
|
31
|
-
export function OperatorIntersect(T, S) {
|
|
32
|
-
const [L, ...R] = T;
|
|
33
|
-
// prettier-ignore
|
|
34
|
-
return (T.length > 0
|
|
35
|
-
? OperatorIncludes(S, L) === true
|
|
36
|
-
? [L, ...OperatorIntersect(R, S)]
|
|
37
|
-
: [...OperatorIntersect(R, S)]
|
|
38
|
-
: []);
|
|
39
|
-
}
|
|
40
|
-
/** Returns the Union of the given sets */
|
|
41
|
-
export function OperatorUnion(T, S, Acc = S) {
|
|
42
|
-
const [L, ...R] = T;
|
|
43
|
-
// prettier-ignore
|
|
44
|
-
return (T.length > 0
|
|
45
|
-
? OperatorUnion(R, S, [...Acc, L])
|
|
46
|
-
: Acc);
|
|
47
|
-
}
|
|
48
|
-
/** Returns the Complement by omitting elements in T that are in S */
|
|
49
|
-
// prettier-ignore
|
|
50
|
-
export function OperatorComplement(T, S, Acc = []) {
|
|
51
|
-
const [L, ...R] = T;
|
|
52
|
-
return (T.length > 0
|
|
53
|
-
? OperatorIncludes(S, L) === true
|
|
54
|
-
? OperatorComplement(R, S, [...Acc])
|
|
55
|
-
: OperatorComplement(R, S, [L, ...Acc])
|
|
56
|
-
: Acc);
|
|
57
|
-
}
|
|
58
|
-
/** Returns the Intersect of multiple sets */
|
|
59
|
-
// prettier-ignore
|
|
60
|
-
export function OperatorIntersectMany(T, Acc = []) {
|
|
61
|
-
return (T.length === 1
|
|
62
|
-
? T[0]
|
|
63
|
-
: (() => {
|
|
64
|
-
const [L, ...R] = T;
|
|
65
|
-
return (L.length > 0
|
|
66
|
-
? OperatorIntersect(L, OperatorIntersectMany(R))
|
|
67
|
-
: []);
|
|
68
|
-
})());
|
|
69
|
-
}
|
|
70
|
-
/** Returns the Union of multiple sets */
|
|
71
|
-
export function OperatorUnionMany(T, Acc = []) {
|
|
72
|
-
const [L, ...R] = T;
|
|
73
|
-
// prettier-ignore
|
|
74
|
-
return (T.length > 0
|
|
75
|
-
? OperatorUnionMany(R, OperatorUnion(Acc, L))
|
|
76
|
-
: Acc);
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './operators';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type TOperatorIncludes<T extends PropertyKey[], S extends PropertyKey> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : TOperatorIncludes<R, S> : false);
|
|
2
|
-
/** Returns true if element S is in the set of T */
|
|
3
|
-
export declare function OperatorIncludes<T extends PropertyKey[], S extends PropertyKey>(T: [...T], S: S): TOperatorIncludes<T, S>;
|
|
4
|
-
export type TOperatorSubset<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<S, L> extends true ? TOperatorSubset<R, S> : false : true);
|
|
5
|
-
/** Returns true if T is a subset of S */
|
|
6
|
-
export declare function OperatorSubset<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TOperatorSubset<T, S>;
|
|
7
|
-
export type TOperatorDistinct<T extends PropertyKey[], Acc extends PropertyKey[] = []> = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<Acc, L> extends false ? TOperatorDistinct<R, [...Acc, L]> : TOperatorDistinct<R, [...Acc]> : Acc;
|
|
8
|
-
/** Returns a distinct set of elements */
|
|
9
|
-
export declare function OperatorDistinct<T extends PropertyKey[]>(T: [...T], Acc?: PropertyKey[]): TOperatorDistinct<T>;
|
|
10
|
-
export type TOperatorIntersect<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<S, L> extends true ? TOperatorIntersect<R, S, [L, ...Acc]> : TOperatorIntersect<R, S, [...Acc]> : Acc);
|
|
11
|
-
/** Returns the Intersect of the given sets */
|
|
12
|
-
export declare function OperatorIntersect<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TOperatorIntersect<T, S>;
|
|
13
|
-
export type TOperatorUnion<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = S> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorUnion<R, S, [...Acc, L]> : Acc);
|
|
14
|
-
/** Returns the Union of the given sets */
|
|
15
|
-
export declare function OperatorUnion<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S], Acc?: PropertyKey[]): TOperatorUnion<T, S>;
|
|
16
|
-
export type OperatorComplement<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TOperatorIncludes<S, L> extends true ? OperatorComplement<R, S, [...Acc]> : OperatorComplement<R, S, [L, ...Acc]> : Acc);
|
|
17
|
-
/** Returns the Complement by omitting elements in T that are in S */
|
|
18
|
-
export declare function OperatorComplement<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S], Acc?: PropertyKey[]): OperatorComplement<T, S>;
|
|
19
|
-
export type OperatorIntersectMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? OperatorIntersectMany<R, TOperatorIntersect<Acc, L>> : Acc);
|
|
20
|
-
/** Returns the Intersect of multiple sets */
|
|
21
|
-
export declare function OperatorIntersectMany<T extends PropertyKey[][]>(T: [...T], Acc?: PropertyKey[]): OperatorIntersectMany<T>;
|
|
22
|
-
export type OperatorUnionMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? OperatorUnionMany<R, TOperatorUnion<Acc, L>> : Acc);
|
|
23
|
-
/** Returns the Union of multiple sets */
|
|
24
|
-
export declare function OperatorUnionMany<T extends PropertyKey[][]>(T: [...T], Acc?: PropertyKey[]): OperatorUnionMany<T>;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OperatorUnionMany = exports.OperatorIntersectMany = exports.OperatorComplement = exports.OperatorUnion = exports.OperatorIntersect = exports.OperatorDistinct = exports.OperatorSubset = exports.OperatorIncludes = void 0;
|
|
5
|
-
/** Returns true if element S is in the set of T */
|
|
6
|
-
// prettier-ignore
|
|
7
|
-
function OperatorIncludes(T, S) {
|
|
8
|
-
const [L, ...R] = T;
|
|
9
|
-
return (T.length > 0
|
|
10
|
-
? S === L
|
|
11
|
-
? true
|
|
12
|
-
: OperatorIncludes(R, S)
|
|
13
|
-
: false);
|
|
14
|
-
}
|
|
15
|
-
exports.OperatorIncludes = OperatorIncludes;
|
|
16
|
-
/** Returns true if T is a subset of S */
|
|
17
|
-
function OperatorSubset(T, S) {
|
|
18
|
-
const [L, ...R] = T;
|
|
19
|
-
// prettier-ignore
|
|
20
|
-
return (T.length > 0
|
|
21
|
-
? OperatorIncludes(S, L) === true
|
|
22
|
-
? OperatorSubset(R, S)
|
|
23
|
-
: false
|
|
24
|
-
: true);
|
|
25
|
-
}
|
|
26
|
-
exports.OperatorSubset = OperatorSubset;
|
|
27
|
-
/** Returns a distinct set of elements */
|
|
28
|
-
function OperatorDistinct(T, Acc = []) {
|
|
29
|
-
const [L, ...R] = T;
|
|
30
|
-
// prettier-ignore
|
|
31
|
-
return (T.length > 0 ?
|
|
32
|
-
(OperatorIncludes(Acc, L) === false
|
|
33
|
-
? OperatorDistinct(R, [...Acc, L])
|
|
34
|
-
: OperatorDistinct(R, [...Acc])) : Acc);
|
|
35
|
-
}
|
|
36
|
-
exports.OperatorDistinct = OperatorDistinct;
|
|
37
|
-
/** Returns the Intersect of the given sets */
|
|
38
|
-
function OperatorIntersect(T, S) {
|
|
39
|
-
const [L, ...R] = T;
|
|
40
|
-
// prettier-ignore
|
|
41
|
-
return (T.length > 0
|
|
42
|
-
? OperatorIncludes(S, L) === true
|
|
43
|
-
? [L, ...OperatorIntersect(R, S)]
|
|
44
|
-
: [...OperatorIntersect(R, S)]
|
|
45
|
-
: []);
|
|
46
|
-
}
|
|
47
|
-
exports.OperatorIntersect = OperatorIntersect;
|
|
48
|
-
/** Returns the Union of the given sets */
|
|
49
|
-
function OperatorUnion(T, S, Acc = S) {
|
|
50
|
-
const [L, ...R] = T;
|
|
51
|
-
// prettier-ignore
|
|
52
|
-
return (T.length > 0
|
|
53
|
-
? OperatorUnion(R, S, [...Acc, L])
|
|
54
|
-
: Acc);
|
|
55
|
-
}
|
|
56
|
-
exports.OperatorUnion = OperatorUnion;
|
|
57
|
-
/** Returns the Complement by omitting elements in T that are in S */
|
|
58
|
-
// prettier-ignore
|
|
59
|
-
function OperatorComplement(T, S, Acc = []) {
|
|
60
|
-
const [L, ...R] = T;
|
|
61
|
-
return (T.length > 0
|
|
62
|
-
? OperatorIncludes(S, L) === true
|
|
63
|
-
? OperatorComplement(R, S, [...Acc])
|
|
64
|
-
: OperatorComplement(R, S, [L, ...Acc])
|
|
65
|
-
: Acc);
|
|
66
|
-
}
|
|
67
|
-
exports.OperatorComplement = OperatorComplement;
|
|
68
|
-
/** Returns the Intersect of multiple sets */
|
|
69
|
-
// prettier-ignore
|
|
70
|
-
function OperatorIntersectMany(T, Acc = []) {
|
|
71
|
-
return (T.length === 1
|
|
72
|
-
? T[0]
|
|
73
|
-
: (() => {
|
|
74
|
-
const [L, ...R] = T;
|
|
75
|
-
return (L.length > 0
|
|
76
|
-
? OperatorIntersect(L, OperatorIntersectMany(R))
|
|
77
|
-
: []);
|
|
78
|
-
})());
|
|
79
|
-
}
|
|
80
|
-
exports.OperatorIntersectMany = OperatorIntersectMany;
|
|
81
|
-
/** Returns the Union of multiple sets */
|
|
82
|
-
function OperatorUnionMany(T, Acc = []) {
|
|
83
|
-
const [L, ...R] = T;
|
|
84
|
-
// prettier-ignore
|
|
85
|
-
return (T.length > 0
|
|
86
|
-
? OperatorUnionMany(R, OperatorUnion(Acc, L))
|
|
87
|
-
: Acc);
|
|
88
|
-
}
|
|
89
|
-
exports.OperatorUnionMany = OperatorUnionMany;
|