UNPKG

@dexpenses/rule-conditions

Version:

Condition engine and parser for Dexpenses rules

22 lines 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class HeaderCondition { constructor(searchString, caseSensitive = false) { this.searchString = searchString; this.caseSensitive = caseSensitive; } test(receipt) { if (!receipt.header) { return false; } if (this.caseSensitive) { return receipt.header.join(' ').includes(this.searchString); } return receipt.header .map((l) => l.toLocaleLowerCase()) .join('') .includes(this.searchString.toLocaleLowerCase()); } } exports.default = HeaderCondition; //# sourceMappingURL=HeaderCondition.js.map