export enum DisplayType { Edit = 'Edit', View = 'View', } /** * Pattern match on a {@link DisplayType} * * usage example: * * ```jsx * const myDisplayType = DisplayType.Edit * * *
* {match({ * Edit: () => , * View: () => view * })} *
* ``` * * @param matchers an object of functions that will be invoked * for each view type */ export function match(matchers: { Edit: () => Z View: () => Z }): (displayType: DisplayType) => Z { return d => (d === DisplayType.Edit ? matchers.Edit() : matchers.View()) }