messages.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.newMessages = newMessages;
  6. function newMessages() {
  7. return {
  8. 'default': 'Validation error on field %s',
  9. required: '%s is required',
  10. 'enum': '%s must be one of %s',
  11. whitespace: '%s cannot be empty',
  12. date: {
  13. format: '%s date %s is invalid for format %s',
  14. parse: '%s date could not be parsed, %s is invalid ',
  15. invalid: '%s date %s is invalid'
  16. },
  17. types: {
  18. string: '%s is not a %s',
  19. method: '%s is not a %s (function)',
  20. array: '%s is not an %s',
  21. object: '%s is not an %s',
  22. number: '%s is not a %s',
  23. date: '%s is not a %s',
  24. boolean: '%s is not a %s',
  25. integer: '%s is not an %s',
  26. float: '%s is not a %s',
  27. regexp: '%s is not a valid %s',
  28. email: '%s is not a valid %s',
  29. url: '%s is not a valid %s',
  30. hex: '%s is not a valid %s'
  31. },
  32. string: {
  33. len: '%s must be exactly %s characters',
  34. min: '%s must be at least %s characters',
  35. max: '%s cannot be longer than %s characters',
  36. range: '%s must be between %s and %s characters'
  37. },
  38. number: {
  39. len: '%s must equal %s',
  40. min: '%s cannot be less than %s',
  41. max: '%s cannot be greater than %s',
  42. range: '%s must be between %s and %s'
  43. },
  44. array: {
  45. len: '%s must be exactly %s in length',
  46. min: '%s cannot be less than %s in length',
  47. max: '%s cannot be greater than %s in length',
  48. range: '%s must be between %s and %s in length'
  49. },
  50. pattern: {
  51. mismatch: '%s value %s does not match pattern %s'
  52. },
  53. clone: function clone() {
  54. var cloned = JSON.parse(JSON.stringify(this));
  55. cloned.clone = this.clone;
  56. return cloned;
  57. }
  58. };
  59. }
  60. var messages = exports.messages = newMessages();