All files utils.js

42.86% Statements 3/7
0% Branches 0/2
50% Functions 1/2
33.33% Lines 2/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20            1x             4x            
 
/**
 * @private
 * @param {int} n The number to pad
 * @param {int} width Size to pad to
 */
const pad0 = (n, width) => {
  const z = '0';
  const nStr = `${n}`;
  const numZ = width - nStr.length;
  return n.length >= width ? nStr : new Array(numZ + 1).join(z) + nStr;
};
 
const findLastIndex = (arr, pred) => arr.length - arr.slice().reverse().findIndex(pred) - 1;
 
export {
  pad0,
  findLastIndex,
};