string.js 439 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.camelize = camelize;
  4. exports.padZero = padZero;
  5. var camelizeRE = /-(\w)/g;
  6. function camelize(str) {
  7. return str.replace(camelizeRE, function (_, c) {
  8. return c.toUpperCase();
  9. });
  10. }
  11. function padZero(num, targetLength) {
  12. if (targetLength === void 0) {
  13. targetLength = 2;
  14. }
  15. var str = num + '';
  16. while (str.length < targetLength) {
  17. str = '0' + str;
  18. }
  19. return str;
  20. }