1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.valueMatchesCriteria = void 0;
|
4 | function valueMatchesCriteria(value, criteria) {
|
5 | if (value == null) {
|
6 | return value === criteria;
|
7 | }
|
8 | else if (Array.isArray(value)) {
|
9 | return (Array.isArray(criteria) &&
|
10 | value.every((val, index) => valueMatchesCriteria(val, criteria[index])));
|
11 | }
|
12 | else if (typeof value === 'object') {
|
13 | return (typeof criteria === 'object' &&
|
14 | criteria &&
|
15 | Object.keys(criteria).every(propertyName => valueMatchesCriteria(value[propertyName], criteria[propertyName])));
|
16 | }
|
17 | else if (criteria instanceof RegExp) {
|
18 | return criteria.test(value);
|
19 | }
|
20 | return value === criteria;
|
21 | }
|
22 | exports.valueMatchesCriteria = valueMatchesCriteria;
|