Deep spread operator (Bilal Abdullah)

Ahad Cove ahadcove at
Tue Oct 23 11:57:10 UTC 2018

Hello Scripters,

I really appreciate everything you all have done for the language and have no complaints over here.
I do have a suggestion though :)

At work we’ve almost got rid of lodash, except we still need it for DeepCopy vs rolling our own.
It’s the same with my side projects. I don’t use lodash because the main times that I need deep copy is when I’m either digging into the Redux store using React, or copying an observable in the Angular world.

I believe ES Script users would appreciate having a deep copy spread operator tremendously.

My proposal is to go off of the current spread operator we currently have in ES and make it 4 dots for a deep spread. This can be used on Objects or Arrays.

const oldDeepObj = {
  InnerObj: {
       func: () => return ‘wow’

const obj = {....oldDeepObj}
obj.innerObj.func = () => return ‘nice’

> wow

Thank you!
Looking forward to hearing back from you all.
If there’s any other questions let me know

- Bilal Abdullah

More information about the es-discuss mailing list