Skip to content

Commit

Permalink
Also allow arrays of UnsafeXML
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Feb 25, 2025
1 parent 8bc48ac commit e62f2f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ prettier: node_modules
check:: node_modules eslint dist
npm ci && npm run test

.PHONY: test
test:
make check

.PHONY: serve
serve: node_modules
$(HTTPSERVE) -p $(HTTPSERVE_PORT)
Expand Down
8 changes: 7 additions & 1 deletion src/stanza.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ export class Stanza extends Builder {
acc +
str +
(Array.isArray(value)
? value.map((v) => (v instanceof Builder ? v : xmlescape(v.toString()))).join('')
? value
.map((v) =>
v instanceof UnsafeXML || v instanceof Builder
? v
: xmlescape(v.toString())
)
.join('')
: value instanceof UnsafeXML || value instanceof Builder
? value
: xmlescape((value ?? '').toString()))
Expand Down

0 comments on commit e62f2f8

Please sign in to comment.