Applies the given parameters to the given dictionary of functions.

Type signature

<T>(fs: {
    [index: string]: (...xs: T[]) => T;
}) => (...xs: T[]) => GenericObject<T>

Examples

const lower = (text) =>
  text.toLowerCase();
const upper = (text) =>
  text.toUpperCase();

apply({ lower, upper })("TeSt");
// ⇒ { lower: "test", upper: "TEST" }
Try in REPL

Questions

  • How to apply a value over an object of functions?

TypeScript sourceJavaScript source