| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 4x 3395x 900x 2495x 786x 1709x 25x 1684x | import { IFilter } from '../interfaces/IFilter';
/**
* Check if a node matches the given filter.
*/
export = function nodeMatchesFilter(node: any, filter: IFilter) {
if (!node[filter.property]) {
return false;
} else if (node[filter.property] === filter.value) {
return true;
} else if (filter.value instanceof RegExp && filter.value.test(node[filter.property])) {
return true;
}
return false;
};
|