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 757B

123456789101112131415161718192021222324
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var padStart = function padStart(string, targetLength, padString) {
  6. targetLength = targetLength >> 0;
  7. string = String(string);
  8. padString = String(padString);
  9. if (string.length > targetLength) {
  10. return String(string);
  11. }
  12. targetLength = targetLength - string.length;
  13. if (targetLength > padString.length) {
  14. padString += padString.repeat(targetLength / padString.length);
  15. }
  16. return padString.slice(0, targetLength) + String(string);
  17. };
  18. exports.default = function (n) {
  19. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  20. return padStart(n, length, '0');
  21. };
  22. //# sourceMappingURL=pad.js.map