From 62adf4607680ba75f8660106967c4b72301f0125 Mon Sep 17 00:00:00 2001 From: Evan Scott Date: Mon, 10 Apr 2017 02:42:50 -0400 Subject: [PATCH] Refactor object.assign -> spread apply To prevent needing to add a polyfill. --- index.js | 56 ++++++++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/index.js b/index.js index 3778a6a9..a12def5f 100644 --- a/index.js +++ b/index.js @@ -412,25 +412,19 @@ export function compiler(markdown, {overrides = {}} = {}) { const key = index || '0'; if (ast.type === 'code' && ast.value) { - const preProps = Object.assign( - {}, - get(overrides, 'pre.props', {}), - { - key - } - ); + const preProps = { + ...get(overrides, 'pre.props', {}), + key, + }; const langClassName = `lang-${ast.lang}`; const codeBaseProps = get(overrides, 'code.props', {}); - const codeProps = Object.assign( - {}, - codeBaseProps, - { - className: codeBaseProps.className - ? `${codeBaseProps.className} ${langClassName}` - : langClassName - } - ); + const codeProps = { + ...codeBaseProps, + className: codeBaseProps.className + ? `${codeBaseProps.className} ${langClassName}` + : langClassName + }; return React.createElement( get(overrides, 'pre.component', 'pre'), @@ -458,24 +452,18 @@ export function compiler(markdown, {overrides = {}} = {}) { if (ast.type === 'listItem') { if (ast.checked === true || ast.checked === false) { - const liProps = Object.assign( - {}, - get(overrides, 'li.props', {}), - { - key - } - ); - - const inputProps = Object.assign( - {}, - get(overrides, 'input.props', {}), - { - key: 'checkbox', - type: 'checkbox', - checked: ast.checked, - readOnly: true - } - ); + const liProps = { + ...get(overrides, 'li.props', {}), + key, + }; + + const inputProps = { + ...get(overrides, 'input.props', {}), + key: 'checkbox', + type: 'checkbox', + checked: ast.checked, + readOnly: true + }; return React.createElement( get(overrides, 'li.component', 'li'),