Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/xpath/xpath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,16 @@

// Handle node set or single value
const jsonStr = Array.isArray(jsonText) ? jsonText[0] : jsonText;
if (!jsonStr) {
return null;
return [];

Check warning on line 325 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 326 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 326 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

// Convert JSON string to XML document node using xpath lib converter
const converter = new JsonToXmlConverter();
const xpathNode = converter.convert(String(jsonStr));

if (!xpathNode) {
return null;
return [];

Check warning on line 333 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 334 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 334 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

// Get owner document from context
Expand All @@ -342,7 +342,7 @@
const convertedNode = this.convertXPathNodeToXNode(xpathNode, ownerDoc);

// Return as array for consistency with xpath processor
return convertedNode ? [convertedNode] : null;
return convertedNode ? [convertedNode] : [];

Check warning on line 345 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 345 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 345 in src/xpath/xpath.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
};

return functions;
Expand Down