Hyperlinkv0.8.0-beta.28

HyperlinkConfigure

HyperlinkConfigure.foldConfigconstsrc/HyperlinkConfigure.ts:91
<T extends object>(
  base: T,
  ...patches: ReadonlyArray<ConfigPatch<T> | undefined>
): T

Fold base and patches left-to-right; later patches see earlier results.

combinators
export const foldConfig = <T extends object>(
  base: T,
  ...patches: ReadonlyArray<ConfigPatch<T> | undefined>
): T => {
  let current = base;
  for (const patch of patches) {
    if (patch === undefined) {
      continue;
    }
    current =
      typeof patch === "function"
        ? patch(current)
        : applyPartialPatch(current, patch);
  }
  return current;
};