Skip to content

Commit 58f64f9

Browse files
authored
Simplify code
Co-authored-by: Alexander Berl <a.berl@outlook.com>
1 parent 1efd314 commit 58f64f9

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/utils/metadataUtil.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ function isPlainObject(value) {
99
function propertyMatchesValue(documentValue, matcherValue) {
1010
if (Array.isArray(matcherValue)) {
1111
return matcherValue.includes(documentValue);
12-
}
13-
if (isPlainObject(matcherValue)) {
12+
} else if (matcherValue && typeof matcherValue === 'object') {
1413
return matches(documentValue, matcherValue);
1514
}
1615
return typeof matcherValue === 'undefined' || documentValue === matcherValue;
@@ -156,9 +155,8 @@ function buildRawBufferMatcher(matcher = {}) {
156155
function preCheck(buffer, startOffset, node) {
157156
for (const child of node.children) {
158157
if (child.valuePatterns && !child.valuePatterns.some((pattern, i) => {
159-
const match = buffer.indexOf(pattern, startOffset);
160-
child.valueMatches[i] = match;
161-
return match !== -1;
158+
child.valueMatches[i] = buffer.indexOf(pattern, startOffset);
159+
return child.valueMatches[i] !== -1;
162160
})) {
163161
return false;
164162
}

0 commit comments

Comments
 (0)