UI for Zipcoin Blue

string.js 790B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  4. function isValidEmail(email) {
  5. if (typeof email !== 'string') {
  6. return false;
  7. }
  8. return EMAIL_REGEX.test(email);
  9. }
  10. exports.isValidEmail = isValidEmail;
  11. function strcmp(a, b) {
  12. if (!a) {
  13. a = '';
  14. }
  15. if (!b) {
  16. b = '';
  17. }
  18. return +(a > b) || +(a === b) - 1;
  19. }
  20. exports.strcmp = strcmp;
  21. function str2num(value, defaultValue = -1) {
  22. if (typeof value === 'number') {
  23. return value;
  24. }
  25. if (typeof value !== 'string') {
  26. return defaultValue;
  27. }
  28. const result = parseInt(value, 10);
  29. if (isNaN(result)) {
  30. return defaultValue;
  31. }
  32. return result;
  33. }
  34. exports.str2num = str2num;