Scratching my head trying to get this optimal. Say I have a function that takes an object as a parameter and destruct it like so:
myfunc = (options = {a:true, b:true, c:true}) => {...}
By default a b and c are true. But say I call myfunc and want b to be false:
myfunc({b:false})
well now options.b === false, but the values for a and c are gone.
Is there away I can accomplish this without having to pass in a copy of the default values?
I tried something weird like
myfunc = (options = Object.assign({a:true, b:true, c:true}, options)) =>{}
but that's certainly not right.