All files / js/lib configure.js

100% Statements 4/4
100% Branches 3/3
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11  14x 65x     65x   65x      
export default function configure(element, userOptions, defaultOptions) {
  return Object.keys(defaultOptions).reduce((options, key) => {
    const attrValue = element.getAttribute(`data-${key.toLowerCase()}`);
 
    // eslint-disable-next-line no-param-reassign
    options[key] = attrValue || userOptions[key] || defaultOptions[key];
 
    return options;
  }, {});
}