Home Reference Source Test

src/pattern-matching/rules/MatcherRule.ts

  1. /**
  2. * @access private
  3. */
  4. export abstract class MatcherRule<Input_Type, Output_Type>{
  5. constructor(
  6. private readonly transformation: (v: Input_Type) => Output_Type,
  7. ) {
  8. }
  9.  
  10. abstract matches(value: Input_Type): boolean;
  11.  
  12. execute(value: Input_Type): Output_Type {
  13. return this.transformation(value);
  14. }
  15. }