zcb 0.0.13 → 0.0.14
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/README.md +5 -1
- package/dist/main/index.mjs +4 -2
- package/dist/main/index.mjs.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/createConfigReader.d.ts +5 -35
- package/dist/types/createConfigReader.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/createConfigReader.test.ts +4 -4
- package/src/createConfigReader.ts +11 -3
|
@@ -1,38 +1,8 @@
|
|
|
1
|
-
/// <reference types="lodash" resolution-mode="require"/>
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Path, Scope } from './types.ts';
|
|
4
|
-
export
|
|
5
|
-
<P extends Path<Config>>(path: P)
|
|
6
|
-
scope<S extends Scope<Config>>(scope: S)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<P_2 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, []>, ".">>(path: P_2): string extends P_2 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, P_2>;
|
|
10
|
-
scope<S_2 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, []>, ".">>(scope: S_2): {
|
|
11
|
-
<P_3 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, []>, ".">>(path: P_3): string extends P_3 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, P_3>;
|
|
12
|
-
scope<S_3 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, []>, ".">>(scope: S_3): {
|
|
13
|
-
<P_4 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, []>, ".">>(path: P_4): string extends P_4 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, P_4>;
|
|
14
|
-
scope<S_4 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, []>, ".">>(scope: S_4): {
|
|
15
|
-
<P_5 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, []>, ".">>(path: P_5): string extends P_5 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, P_5>;
|
|
16
|
-
scope<S_5 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, []>, ".">>(scope: S_5): {
|
|
17
|
-
<P_6 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, []>, ".">>(path: P_6): string extends P_6 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, P_6>;
|
|
18
|
-
scope<S_6 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, []>, ".">>(scope: S_6): {
|
|
19
|
-
<P_7 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, []>, ".">>(path: P_7): string extends P_7 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, P_7>;
|
|
20
|
-
scope<S_7 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, []>, ".">>(scope: S_7): {
|
|
21
|
-
<P_8 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, []>, ".">>(path: P_8): string extends P_8 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, P_8>;
|
|
22
|
-
scope<S_8 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, []>, ".">>(scope: S_8): {
|
|
23
|
-
<P_9 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, S_8 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_8>, "."> : S_8, {}>, []>, ".">>(path: P_9): string extends P_9 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, S_8 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_8>, "."> : S_8, {}>, P_9>;
|
|
24
|
-
scope<S_9 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, S_8 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_8>, "."> : S_8, {}>, []>, ".">>(scope: S_9): {
|
|
25
|
-
<P_10 extends import("type-fest").Join<import("./types.ts").Leaves<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, S_8 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_8>, "."> : S_8, {}>, S_9 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_9>, "."> : S_9, {}>, []>, ".">>(path: P_10): string extends P_10 ? any : import("lodash").GetFieldType<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, S_8 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_8>, "."> : S_8, {}>, S_9 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_9>, "."> : S_9, {}>, P_10>;
|
|
26
|
-
scope<S_10 extends import("type-fest").Join<import("./types.ts").Paths<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<import("type-fest/source/get.js").GetWithPath<Get<Config, S>, S_1 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_1>, "."> : S_1, {}>, S_2 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_2>, "."> : S_2, {}>, S_3 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_3>, "."> : S_3, {}>, S_4 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_4>, "."> : S_4, {}>, S_5 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_5>, "."> : S_5, {}>, S_6 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_6>, "."> : S_6, {}>, S_7 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_7>, "."> : S_7, {}>, S_8 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_8>, "."> : S_8, {}>, S_9 extends string ? import("type-fest").Split<import("type-fest/source/get.js").FixPathSquareBrackets<S_9>, "."> : S_9, {}>, []>, ".">>(scope: S_10): any;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
3
|
+
export interface ConfigReader<Config extends object> {
|
|
4
|
+
read: <P extends Path<Config>>(path: P) => Get<Config, P>;
|
|
5
|
+
scope: <S extends Scope<Config>>(scope: S) => ConfigReader<Get<Config, S>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const createConfigReader: <Config extends object>(config: Config) => ConfigReader<Config>;
|
|
38
8
|
//# sourceMappingURL=createConfigReader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createConfigReader.d.ts","sourceRoot":"","sources":["../../src/createConfigReader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createConfigReader.d.ts","sourceRoot":"","sources":["../../src/createConfigReader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,MAAM;IACjD,IAAI,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;CAC5E;AAED,eAAO,MAAM,kBAAkB,iEAO9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ describe('createConfigReader', () => {
|
|
|
4
4
|
describe('when a user accesses a known property', () => {
|
|
5
5
|
it('should return the correct value', () => {
|
|
6
6
|
const reader = createReader();
|
|
7
|
-
const value = reader('countryCode');
|
|
7
|
+
const value = reader.read('countryCode');
|
|
8
8
|
expect(value).toBe('GB');
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -12,7 +12,7 @@ describe('createConfigReader', () => {
|
|
|
12
12
|
describe('when a user accesses a known nested property', () => {
|
|
13
13
|
it('should return the correct value', () => {
|
|
14
14
|
const reader = createReader();
|
|
15
|
-
const value = reader('pages.contactDetails.name');
|
|
15
|
+
const value = reader.read('pages.contactDetails.name');
|
|
16
16
|
expect(value).toBe('contactDetails');
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -22,7 +22,7 @@ describe('createConfigReader', () => {
|
|
|
22
22
|
it('should return the correct value', () => {
|
|
23
23
|
const reader = createReader();
|
|
24
24
|
const scopedReader = reader.scope('pages.contactDetails');
|
|
25
|
-
const value = scopedReader('name');
|
|
25
|
+
const value = scopedReader.read('name');
|
|
26
26
|
expect(value).toBe('contactDetails');
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -33,7 +33,7 @@ describe('createConfigReader', () => {
|
|
|
33
33
|
it('should return the correct value', () => {
|
|
34
34
|
const reader = createReader();
|
|
35
35
|
const scopedReader = reader.scope('pages.contactDetails').scope('sections.1.sections').scope('0');
|
|
36
|
-
const value = scopedReader('name');
|
|
36
|
+
const value = scopedReader.read('name');
|
|
37
37
|
expect(value).toBe('main');
|
|
38
38
|
});
|
|
39
39
|
});
|
|
@@ -2,8 +2,16 @@ import get from 'lodash/get.js';
|
|
|
2
2
|
import type { Get } from 'type-fest';
|
|
3
3
|
import type { Path, Scope } from './types.ts';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export interface ConfigReader<Config extends object> {
|
|
6
|
+
read: <P extends Path<Config>>(path: P) => Get<Config, P>;
|
|
7
|
+
scope: <S extends Scope<Config>>(scope: S) => ConfigReader<Get<Config, S>>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const createConfigReader = <Config extends object>(config: Config): ConfigReader<Config> => {
|
|
11
|
+
const configReader = {
|
|
12
|
+
read: <P extends Path<Config>>(path: P) => get(config, path),
|
|
13
|
+
scope: <S extends Scope<Config>>(scope: S) => createConfigReader(get(config, scope) as Get<Config, S>),
|
|
14
|
+
} as ConfigReader<Config>;
|
|
15
|
+
|
|
8
16
|
return configReader;
|
|
9
17
|
};
|