Properties from Object's prototype are including during XML creation (original) (raw)
- Are you running the latest version?
- Have you included sample input, output, error, and expected output?
- Have you checked if you are using correct configuration?
- Did you try online tool?
Description
If a custom property is added to Object's prototype, it is included in generated XML. It shouldn't happen because in some cases users can't control pollution of Object / Array prototypes.
Input
{a: 1}
Code
const { XMLBuilder } = require("fast-xml-parser");
// emulate pollution of Object's prototype Object.prototype.something = 'strange';
const builder = new XMLBuilder(); const xml = builder.build({ a: 1 });
console.log(xml);
Output
<a>1</a><something>strange</something>
Expected output
Would you like to work on this issue?
- Yes
- No
Bookmark this repository for further updates. Visit SoloThought to know about recent features.