Paulo Gustavo Veiga 5ee7448d3c Format JS files.
2022-07-12 18:58:11 -07:00

23 lines
575 B
JavaScript

import merge from 'lodash/merge';
class Options {
setOptions(...args) {
const options = merge({}, this.options, ...args);
this.options = options;
if (this.addEvent) {
const optionsKeys = Object.keys(options);
for (let index = 0; index < optionsKeys.length; index++) {
const option = optionsKeys[index];
if (typeof options[option] === 'function' && /^on[A-Z]/.test(option)) {
this.addEvent(option, options[option]);
delete options[option];
}
}
}
return this;
}
}
export default Options;