checkers.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Generated by IcedCoffeeScript 1.7.1-c
  2. (function() {
  3. var checkers;
  4. exports.checkers = checkers = {
  5. username: {
  6. hint: "between 2 and 16 letters long",
  7. f: function(x) {
  8. return x.length >= 2 && x.length <= 16;
  9. }
  10. },
  11. remote_username: {
  12. hint: "between 1 and 40 letters long",
  13. f: function(x) {
  14. return x.length >= 1 && x.length <= 40;
  15. }
  16. },
  17. passphrase: {
  18. hint: "must be at least 12 letters long",
  19. f: function(x) {
  20. return x.length >= 12;
  21. }
  22. },
  23. passphrase_short: {
  24. hint: "password cannot be empty",
  25. f: function(x) {
  26. return x.length >= 1;
  27. }
  28. },
  29. passphrase_nls: {
  30. hint: "must be at least 12 letters long and can't have a leading space",
  31. f: function(x) {
  32. return x.length >= 12 && !(x.match(/^\s/));
  33. }
  34. },
  35. email: {
  36. hint: "must be a valid email address",
  37. f: function(x) {
  38. return (x.length > 3) && x.match(/^\S+@\S+\.\S+$/);
  39. }
  40. },
  41. email_or_username: {
  42. hint: "valid usernames are 4-12 letters long"
  43. },
  44. intcheck: function(lo, hi, defint) {
  45. return {
  46. hint: "" + lo + "-" + hi,
  47. f: function(x) {
  48. var i;
  49. if ((defint != null) && x === "") {
  50. return true;
  51. } else {
  52. return !(isNaN(i = parseInt(x))) && i >= lo && i <= hi;
  53. }
  54. }
  55. };
  56. }
  57. };
  58. checkers.email_or_username.f = function(x) {
  59. return checkers.email.f(x) || checkers.username.f(x);
  60. };
  61. }).call(this);