@benev/slate
Version:
frontend web stuff
18 lines • 668 B
JavaScript
import { ob } from "./ob.js";
/**
* establish a pattern for creating many things that have a common requirement.
* - `const contextual = requirement<Context>()<Flipview<any>>`
* - now you can use `contextual` as a template for creating things that require context
* - `const MyView = contextual(context => flipview())`
* - in that example, the requirement enforces the types for context and the view
*/
export function requirement() {
return function (fun) {
return fun;
};
}
/**
* provide a requirement to a group of things.
*/
requirement.provide = (r) => ((group) => ob(group).map(fun => fun(r)));
//# sourceMappingURL=requirement.js.map