This is a fairly specific implementation of the mediator pattern - given a string name, it calls a function and returns a promise with the function's response.
It accomplishes the same goals as many dependency injection libraries (loose coupling, better testability), but focuses only on functions, and always returning asynchronous responses.
Mannish focuses on decoupling the calling of functions and getting a response back.
This library exports a single function that returns a new mediator.
Supplies a function to handle all calls to the given name.
You can return either a plain value, or a promise/thenable.
Call whatever function is registered with the string
name, with all other arguments being passed straight through.
No matter what the other function returns,
call returns a
Promise containing the value it resolves to.
const recipe = type: 'recipe' contents: 'Step 1: find a real cook book'mediator
providereturn a removal function?)