Skip to content

Commit

Permalink
test(examples): Check for null before using document
Browse files Browse the repository at this point in the history
  • Loading branch information
karfau committed Mar 6, 2022
1 parent 9b46871 commit b1babe9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/typescript-node-es6/src/index.ts
Expand Up @@ -7,6 +7,8 @@ const source = `<xml xmlns="a">

const doc = new DOMParser().parseFromString(source, 'text/xml')

if (!doc) throw 'expected Document but was null'

const serialized = new XMLSerializer().serializeToString(doc)

if (source !== serialized) {
Expand Down

0 comments on commit b1babe9

Please sign in to comment.