/** Returns a string representation of the `num` that is padded with leading "0"s if necessary
 *
 * @param num - The number to pad
 * @param width - The width of the string at which no lead padding is necessary
 * @returns - The number converted to a string with leading zero padding if the number of digits is less than `width`
 */
export default function pad(num: number, width: number) {
  let s = String(num);
  while (s.length < width) {
    s = `0${s}`;
  }
  return s;
}
