tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
16 lines (13 loc) • 437 B
text/typescript
import { TinyType } from '../../TinyType';
import { MatcherRule } from './MatcherRule';
/**
* @access private
*/
export class MatchesEqualTinyType<Output_Type> extends MatcherRule<TinyType, Output_Type> {
constructor(private readonly pattern: TinyType, transformation: (v: TinyType) => Output_Type) {
super(transformation);
}
matches(value: TinyType): boolean {
return this.pattern.equals(value);
}
}