<T extends object>(
base: T,
...patches: ReadonlyArray<ConfigPatch<T> | undefined>
): TFold base and patches left-to-right; later patches see earlier results.
combinators
Source src/HyperlinkConfigure.ts:9116 lines
export const const foldConfig: <T extends object>(
base: T,
...patches: ReadonlyArray<
ConfigPatch<T> | undefined
>
) => T
Fold base and patches left-to-right; later patches see earlier results.
foldConfig = <function (type parameter) T in <T extends object>(base: T, ...patches: ReadonlyArray<ConfigPatch<T> | undefined>): TT extends object>(
base: T extends objectbase: function (type parameter) T in <T extends object>(base: T, ...patches: ReadonlyArray<ConfigPatch<T> | undefined>): TT,
...patches: ReadonlyArray<
ConfigPatch<T> | undefined
>
patches: interface ReadonlyArray<T>ReadonlyArray<type ConfigPatch<T> =
| PartialConfigPatch<T>
| ((previous: T) => T)
Patch for a resource or process spec.
- Partial object — shallow-merge fields; use a function value to replace a field.
effect field — a unary function (previous) => next updates the prior worker /
supervised body; a multi-argument function value replaces effect outright (queue workers
stay two-argument).
- Full reducer —
(previous) => next over the whole spec (see
configureLayer
).
ConfigPatch<function (type parameter) T in <T extends object>(base: T, ...patches: ReadonlyArray<ConfigPatch<T> | undefined>): TT> | undefined>
): function (type parameter) T in <T extends object>(base: T, ...patches: ReadonlyArray<ConfigPatch<T> | undefined>): TT => {
let let current: T extends objectcurrent = base: T extends objectbase;
for (const const patch: ConfigPatch<T> | undefinedpatch of patches: ReadonlyArray<
ConfigPatch<T> | undefined
>
patches) {
if (const patch: ConfigPatch<T> | undefinedpatch === var undefinedundefined) {
continue;
}
let current: T extends objectcurrent =
typeof const patch: ConfigPatch<T>patch === "function"
? const patch: (previous: T) => Tpatch(let current: T extends objectcurrent)
: const applyPartialPatch: <T>(
current: T,
partial: PartialConfigPatch<T>
) => T
applyPartialPatch(let current: T extends objectcurrent, const patch: PartialConfigPatch<T>patch);
}
return let current: T extends objectcurrent;
};