UNPKG

@n1k1t/mock-server

Version:

The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations

35 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const operator_1 = require("../models/operator"); const utils_1 = require("../utils"); class OrExpectationOperator extends operator_1.ExpectationOperator { constructor() { super(...arguments); this.compiled = this.command .map((schema) => this.extractNestedSchema(schema)) .filter(Boolean) .map((extracted) => { const Operator = this.operators[extracted.key]; return new Operator(this.operators, extracted.nested); }); } get tags() { return (0, utils_1.mergeMetaTags)(this.compiled.map((operator) => operator.tags)); } async match(context) { for (const operator of this.compiled) { if (await operator.match(context)) { return true; } } return false; } async manipulate(context) { for (const operator of this.compiled) { await operator.manipulate(context); } return context; } } exports.default = OrExpectationOperator; //# sourceMappingURL=or.operator.js.map