inferred-types 0.18.2 → 0.19.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/dist/index.d.ts +24 -13
- package/dist/index.js +5 -11
- package/dist/index.mjs +5 -10
- package/on-hold/Builder/index.ts +2 -2
- package/on-hold/types/index.ts +2 -2
- package/package.json +13 -15
- package/src/Mutation/index.ts +2 -2
- package/src/index.ts +2 -2
- package/src/shared/index.ts +2 -2
- package/src/types/Where.ts +19 -15
- package/src/types/alphabetic/index.ts +2 -2
- package/src/types/dictionary/NotEmptyObject.ts +9 -0
- package/src/types/dictionary/index.ts +3 -2
- package/src/types/fluent/index.ts +2 -2
- package/src/types/index.ts +2 -2
- package/src/types/kv/index.ts +2 -2
- package/src/types/lists/index.ts +2 -2
- package/src/types/string-literals/index.ts +2 -2
- package/src/types/tuples/FromDictArray.ts +1 -1
- package/src/types/tuples/index.ts +2 -2
- package/src/types/type-conversion/UnwrapValue.ts +13 -0
- package/src/types/type-conversion/index.ts +3 -2
- package/src/utility/api/index.ts +2 -2
- package/src/utility/createFnWithProps.ts +1 -1
- package/src/utility/dictionary/index.ts +2 -3
- package/src/utility/dictionary/kv/index.ts +2 -2
- package/src/utility/index.ts +2 -2
- package/src/utility/lists/index.ts +2 -2
- package/src/utility/literals/index.ts +2 -2
- package/src/utility/map-reduce/index.ts +2 -2
- package/src/utility/modelling/index.ts +2 -2
- package/src/utility/runtime/conditions/index.ts +2 -2
- package/src/utility/runtime/index.ts +2 -2
- package/src/utility/state/Configurator.ts +12 -3
- package/src/utility/state/index.ts +2 -2
- package/tests/data/index.ts +2 -2
- package/tests/kv/dict-to-kv-and-back.spec.ts +24 -22
- package/.tsbuildinfo +0 -1
- package/pnpm-lock.yaml +0 -6388
- package/src/utility/dictionary/dictFilter.ts +0 -19
- package/tests/kv/dictFilter.ts +0 -8
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "~/types";
|
|
2
|
-
import { omit } from "native-dash";
|
|
3
|
-
import { keys } from "../keys";
|
|
4
|
-
|
|
5
|
-
export type ObjFilterCallback<T extends object, R extends boolean> = (k: keyof T, state: T) => R;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* **dictFilter**
|
|
9
|
-
*
|
|
10
|
-
* Provides a means ot filter down the properties on a given object.
|
|
11
|
-
*/
|
|
12
|
-
export function dictFilter<N extends Narrowable, T extends Record<string, N>, R extends boolean>(
|
|
13
|
-
obj: T,
|
|
14
|
-
cb: ObjFilterCallback<T, R>
|
|
15
|
-
) {
|
|
16
|
-
const remove = keys(obj).filter((k) => !cb(k, obj));
|
|
17
|
-
|
|
18
|
-
return omit(obj, ...keys(obj).filter((k) => !cb(k, obj))) as Exclude<T, typeof remove>;
|
|
19
|
-
}
|
package/tests/kv/dictFilter.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// import { dictFilter, dictToKv, isFunction } from "~/utility";
|
|
2
|
-
|
|
3
|
-
describe("dictFilter()", () => {
|
|
4
|
-
// it("able to remove based on value type", () => {
|
|
5
|
-
// const arr = dictToKv({ id: 123, foo: "hi", bar: false });
|
|
6
|
-
// const f = dictFilter({ id: 123, foo: "hi", bar: false }, );
|
|
7
|
-
// });
|
|
8
|
-
});
|