wisemapping-frontend/packages/mindplot/src/components/Options.js
Matias Arriola b5fd708971 Merged in feature/mindplot-lint (pull request #11)
mindplot lint

* fix eqeqeq

* fix max-len

* fix max-len, guard-for-in

* fix import/no-named-as-default-member

* misc fixes

* fix no-shadow

* fix no-param-reassign

* fix issues introduced with "fix no-param-reassign"

* Merge 'origin/develop' into feature/mindplot-lint

* lint and docs fixes after merge


Approved-by: Paulo Veiga
2021-12-20 20:54:31 +00:00

23 lines
579 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;