Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"env": {
"test": {
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
}
}
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"env": {
"browser": true,
"node": true,
"mocha": true
"test": true
}
}
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export default defineConfig([
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.mocha
...globals.node
},

parser: babelParser,
Expand Down
8 changes: 7 additions & 1 deletion jstoxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ export const toXML = (obj = {}, config = {}) => {
case DATA_TYPES.JSTOXML_OBJECT: {
// Processes a specially-formatted object used by jstoxml.

const { _name, _content } = obj;
const { _name, _content, _attrs, ...invalidSiblings } = obj;

if (Object.keys(invalidSiblings).length > 0) {
console.warn(
`Unexpected sibling ${Object.keys(invalidSiblings).join(', ')}. When using _content, the only siblings recognized are _name and _attrs.`
);
}

// Output text content without a tag wrapper.
if (_content === null && typeof contentMap !== 'function') {
Expand Down
Loading