Skip to content

Instantly share code, notes, and snippets.

@sanohin
Created January 12, 2018 10:37
Show Gist options
  • Select an option

  • Save sanohin/99d73b86ddf1a8a09005964b334ee4d0 to your computer and use it in GitHub Desktop.

Select an option

Save sanohin/99d73b86ddf1a8a09005964b334ee4d0 to your computer and use it in GitHub Desktop.
const SomeMap = {
fn1: ({ a }: { a: number }) => ({ a, b: 1 }),
fn2: ({ c }: { c: string }) => ({ c, d: 1 })
};
const someFunction = someFns => params => {
const someValue = someFns.reduce((acc, cur) => {
acc.push(cur(params));
return acc;
}, []);
};
someFunction([SomeMap.fn1, SomeMap.fn2])({ a: 2, c: 4 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment