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) && value.every((val, index) => valueMatchesCriteria(val, criteria[index]));
|
10 | }
|
11 | else if (typeof value === 'object') {
|
12 | return (typeof criteria === 'object' &&
|
13 | criteria &&
|
14 | Object.keys(criteria).every(propertyName => valueMatchesCriteria(value[propertyName], criteria[propertyName])));
|
15 | }
|
16 | else if (criteria instanceof RegExp) {
|
17 | return criteria.test(value);
|
18 | }
|
19 | return value === criteria;
|
20 | }
|
21 | exports.valueMatchesCriteria = valueMatchesCriteria;
|