Open
Description
If I do:
const withRoot = Object.freeze({ [tagName]: json })
const snippet = xml.stringify(withRoot)
And error will be thrown:
error: TypeError: Cannot add property ~name, object is not extensible
;(document as Record<PropertyKey, unknown>)["~name"] ??= "xml"
^
at xml_prolog (https://jsr.io/@libs/xml/6.0.4/stringify.ts:135:55)
at Module.stringify (https://jsr.io/@libs/xml/6.0.4/stringify.ts:74:11)
In general, an operation to translate one object into another should not alter the source object.
(thank you for this library - it is the best xml parser out there)
Activity