tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
16 lines (13 loc) • 340 B
text/typescript
/**
* @access private
*/
export abstract class MatcherRule<Input_Type, Output_Type>{
constructor(
private readonly transformation: (v: Input_Type) => Output_Type,
) {
}
abstract matches(value: Input_Type): boolean;
execute(value: Input_Type): Output_Type {
return this.transformation(value);
}
}