Spread object support for safari 10

Problem

I got error message “Unexpected token ‘…’. Expected a property name.” when using Safari 10.

Cause

Due to Document Spread in object literals only support Safari version 11.1 and later.

Solution

Using this plugin to parse spread to Object assign

{
  "plugins": ["@babel/plugin-proposal-object-rest-spread"]
}

In

z = { x, ...y };

Out

z = Object.assign({ x }, y);