mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-04 13:29:13 -04:00
fix: typing
This commit is contained in:
parent
5724ca346f
commit
2ca3a1fe96
1 changed files with 2 additions and 1 deletions
|
@ -9,7 +9,8 @@ const xml = ref('<book><title>Harry Potter</title></book>');
|
||||||
const selectedNodes = computed(() => {
|
const selectedNodes = computed(() => {
|
||||||
try {
|
try {
|
||||||
const doc = new DOMParser().parseFromString(xml.value, 'text/xml');
|
const doc = new DOMParser().parseFromString(xml.value, 'text/xml');
|
||||||
return XPathEngine.select(xpath.value, doc);
|
const result = XPathEngine.select(xpath.value, doc);
|
||||||
|
return Array.isArray(result) ? result : [result];
|
||||||
}
|
}
|
||||||
catch (e: any) {
|
catch (e: any) {
|
||||||
return [e.toString()];
|
return [e.toString()];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue