inferred-types 0.25.0 → 0.27.0
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/.vscode/settings.json +1 -0
- package/dist/index.d.ts +308 -84
- package/dist/index.js +378 -262
- package/dist/index.mjs +370 -259
- package/package.json +1 -1
- package/src/types/alphabetic/Cardinality.ts +80 -0
- package/src/types/alphabetic/index.ts +1 -0
- package/src/types/dictionary/MapTo.ts +128 -15
- package/src/types/functions/LogicFunction.ts +4 -0
- package/src/types/functions/index.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/literal-unions/OptRequired.ts +4 -0
- package/src/types/literal-unions/index.ts +1 -0
- package/src/types/string-literals/Replace.ts +8 -4
- package/src/utility/boolean-logic/and.ts +15 -0
- package/src/utility/boolean-logic/filter.ts +268 -0
- package/src/utility/boolean-logic/index.ts +4 -0
- package/src/utility/boolean-logic/not.ts +15 -0
- package/src/utility/boolean-logic/or.ts +15 -0
- package/src/utility/dictionary/mapTo.ts +117 -30
- package/src/utility/index.ts +1 -1
- package/src/utility/lists/asArray.ts +34 -0
- package/src/utility/lists/index.ts +1 -0
- package/tests/boolean-logic/boolean.spec.ts +21 -0
- package/tests/boolean-logic/filter.spec.ts +52 -0
- package/tests/createFnWithProps.spec.ts +1 -0
- package/tests/dictionary/mapTo.test.ts +159 -92
- package/tests/lists/asArray.test.ts +91 -0
- package/src/utility/map-reduce/filter.ts +0 -35
- package/src/utility/map-reduce/index.ts +0 -12
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// inspired by [article](https://medium.com/@reidev275/creating-a-type-safe-dsl-for-filtering-in-typescript-53fe68a7942e)]
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type Filter<A> =
|
|
5
|
-
| { kind: "Equals"; field: keyof A; val: A[keyof A] }
|
|
6
|
-
| { kind: "Greater"; field: keyof A; val: A[keyof A] }
|
|
7
|
-
| { kind: "Less"; field: keyof A; val: A[keyof A] }
|
|
8
|
-
| { kind: "And"; a: Filter<A>; b: Filter<A> }
|
|
9
|
-
| { kind: "Or"; a: Filter<A>; b: Filter<A> };
|
|
10
|
-
|
|
11
|
-
export const equals = <A, K extends keyof A>(field: K, val: A[K]): Filter<A> => ({
|
|
12
|
-
kind: "Equals",
|
|
13
|
-
field,
|
|
14
|
-
val
|
|
15
|
-
});
|
|
16
|
-
export const greater = <A, K extends keyof A>(field: K, val: A[K]): Filter<A> => ({
|
|
17
|
-
kind: "Greater",
|
|
18
|
-
field,
|
|
19
|
-
val
|
|
20
|
-
});
|
|
21
|
-
export const less = <A, K extends keyof A>(field: K, val: A[K]): Filter<A> => ({
|
|
22
|
-
kind: "Less",
|
|
23
|
-
field,
|
|
24
|
-
val
|
|
25
|
-
});
|
|
26
|
-
export const and = <A>(a: Filter<A>, b: Filter<A>): Filter<A> => ({
|
|
27
|
-
kind: "And",
|
|
28
|
-
a,
|
|
29
|
-
b
|
|
30
|
-
});
|
|
31
|
-
export const or = <A>(a: Filter<A>, b: Filter<A>): Filter<A> => ({
|
|
32
|
-
kind: "Or",
|
|
33
|
-
a,
|
|
34
|
-
b
|
|
35
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// #autoindex
|
|
2
|
-
// #region auto-indexed files
|
|
3
|
-
// index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
|
|
4
|
-
// hash-code: 5ffc538b
|
|
5
|
-
|
|
6
|
-
// file exports
|
|
7
|
-
export * from "./filter";
|
|
8
|
-
|
|
9
|
-
// #endregion auto-indexed files
|
|
10
|
-
|
|
11
|
-
// see https://github.com/inocan-group/do-devops/docs/autoindex.md
|
|
12
|
-
// for more info
|