Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pad.js 673B

123456789101112131415161718
  1. var padStart = function padStart(string, targetLength, padString) {
  2. targetLength = targetLength >> 0;
  3. string = String(string);
  4. padString = String(padString);
  5. if (string.length > targetLength) {
  6. return String(string);
  7. }
  8. targetLength = targetLength - string.length;
  9. if (targetLength > padString.length) {
  10. padString += padString.repeat(targetLength / padString.length);
  11. }
  12. return padString.slice(0, targetLength) + String(string);
  13. };
  14. export default (function (n) {
  15. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  16. return padStart(n, length, '0');
  17. });
  18. //# sourceMappingURL=pad.js.map