Default options argument in initializers
In this release the initializers won't need to check if the option argument was passed:
const MyStamp = compose({initializers: [
function (options = {}) { // <-- not needed any more
console.log(options.opt1); // used to throw here
}
]});
The line below will just work now.
const MyStamp = compose({initializers: [
function (options) {
console.log(options.opt1); // used to throw here
}
]});
MyStamp();
Previously it was throwing. So that you always had to pass an empty object:
MyStamp({});
Although, this won't save you from the following:
MyStamp(null); // will throw regardless
MyStamp(42); // will throw regardless