function formatPadding(ch, pad) {
  var res = pad ? pad + ch : ch;

  if (pad && ch.toString().charAt(0) === '-') {
    res = '-' + pad + ch.toString().substr(1);
  }

  return res.toString();
}
Format padding, taking leading `-` into account