All files / components Utilities.js

26.67% Statements 4/15
7.14% Branches 1/14
66.67% Functions 2/3
15.38% Lines 2/13

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  2x 1x                                                        
 
const splitIcon = icon => (icon ? icon.match(/^([fab|fas|far]*)-?(.+)/).splice(1, 2).filter(p => p.length > 0) : null);
const arrayEquals = (a, b) => {
  // if the other array is a falsy value, return
  if (!b) {
    return false;
  }
 
  // compare lengths - can save a lot of time
  if (a.length !== b.length) {
    return false;
  }
 
  // eslint-disable-next-line no-plusplus
  for (let i = 0, l = a.length; i < l; i++) {
    // Check if we have nested arrays
    if (a[i] instanceof Array && b[i] instanceof Array) {
      // recurse into the nested arrays
      if (!a[i].equals(b[i])) {
        return false;
      }
    } else if (a[i] !== b[i]) {
      // Warning - two different object instances will never be equal: {x:20} != {x:20}
      return false;
    }
  }
  return true;
};
 
export { splitIcon, arrayEquals };