Skip to content

Commit 14f7416

Browse files
authored
Don't use spread operator (#283)
Importing @mdx-js/runtime in create-react-app v1 fails because of spread operators.
1 parent 678b5f1 commit 14f7416

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/mdx/mdx-hast-to-jsx.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ function toJSX(node, parentNode = {}, options = {}) {
1717
// ariaProperty => aria-property
1818
// dataProperty => data-property
1919
const paramCaseRe = /^(aria[A-Z])|(data[A-Z])/
20-
node.properties = Object.entries(node.properties).reduce((properties, [key, value]) => ({
21-
...properties,
22-
[paramCaseRe.test(key) ? paramCase(key) : key]: value,
23-
}), {})
20+
node.properties = Object.entries(node.properties).reduce((properties, [key, value]) => Object.assign(
21+
{},
22+
properties,
23+
{ [paramCaseRe.test(key) ? paramCase(key) : key]: value },
24+
), {})
2425
}
2526

2627
if (node.type === 'root') {
@@ -102,11 +103,10 @@ function toJSX(node, parentNode = {}, options = {}) {
102103
// recursively walk through children
103104
if (node.children) {
104105
children = node.children.map(childNode => {
105-
const childOptions = {
106-
...options,
106+
const childOptions = Object.assign({}, options, {
107107
// tell all children inside <pre> tags to preserve newlines as text nodes
108108
preserveNewlines: preserveNewlines || node.tagName === 'pre',
109-
}
109+
})
110110
return toJSX(childNode, node, childOptions)
111111
}).join('')
112112
}

0 commit comments

Comments
 (0)