I would like to know if is possible to change attributes of an object passed to a function without mutating the state of the object.
Something like this:
function startOfLine(options) {
options.someProp = += 'startOfLine';
return options;
}
function otherFunction(options) {
// do something with options and...
return options;
}
const options = startOfLine(otherFunction({
somePro: '',
someProp2: ''
}));
I'm going to create the execution of the functions in a dynamic way, that's why i'm not worry about nesting 20 levels of calls.
Thanks.