conventions for 3rd party modules (work in progess).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Fn = () => any; | |
export function Match<T extends any>(data: T) { | |
const cases: Array<{ condition: any; action?: Fn }> = []; | |
let once = true; | |
return { | |
case(condition: T, action: Fn) { | |
cases.push({ condition, action }); | |
return this; |