All files / style9 index.js

100% Statements 14/14
100% Branches 4/4
100% Functions 3/3
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42  39x 54x 18x   36x       39x       19x   19x 30x 30x 10x   20x       19x       9x 9x                        
function merge(target, source) {
  for (const key in source) {
    if (typeof source[key] === 'object') {
      target[key] = merge({ ...target[key] }, source[key]);
    } else {
      target[key] = source[key];
    }
  }
 
  return target;
}
 
function getValues(obj) {
  const values = [];
 
  for (const key in obj) {
    const val = obj[key];
    if (typeof val === 'object') {
      values.push(...getValues(val));
    } else {
      values.push(val);
    }
  }
 
  return values;
}
 
export default function style9(...styles) {
  const merged = styles.reduce(merge, {});
  return getValues(merged).join(' ');
}
 
// istanbul ignore next
style9.create = () => {
  throw new Error('style9.create calls should be compiled away');
};
 
// istanbul ignore next
style9.keyframes = () => {
  throw new Error('style9.keyframes calls should be compiled away');
};