UNPKG

@clawject/di

Version:

<p align="center"> <a href="https://clawject.com/" target="_blank"><img src="https://clawject.com/img/logo.svg" align="center" alt="Clawject Logo" width="120" height="120" /></a> </p>

35 lines (34 loc) 985 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Condition = void 0; /** @public */ class Condition { cacheable() { return true; } and(other) { // eslint-disable-next-line @typescript-eslint/no-this-alias const instance = this; return new class extends Condition { matches() { return instance.matches() && other.matches(); } cacheable() { return instance.cacheable() && other.cacheable(); } }; } or(other) { // eslint-disable-next-line @typescript-eslint/no-this-alias const instance = this; return new class extends Condition { matches() { return instance.matches() || other.matches(); } cacheable() { return instance.cacheable() || other.cacheable(); } }; } } exports.Condition = Condition;