Here’s some sample code for an object in my app. There’s a lot of repetition as I initialize and set defaults for properties of the Circle object:
The change is really simple. But using the Lo-Dash method,
_.assign, I can take the props object which contains the default properties for the Circle object and assign the values contained in the config object. The config object is passed into the Circle object when it’s called (as shown right after the object definition in the code snippet above).