constants.js 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. // The minimum length of the national significant number.
  2. export const MIN_LENGTH_FOR_NSN = 2
  3. // The ITU says the maximum length should be 15,
  4. // but one can find longer numbers in Germany.
  5. export const MAX_LENGTH_FOR_NSN = 17
  6. // The maximum length of the country calling code.
  7. export const MAX_LENGTH_COUNTRY_CODE = 3
  8. // Digits accepted in phone numbers
  9. // (ascii, fullwidth, arabic-indic, and eastern arabic digits).
  10. export const VALID_DIGITS = '0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9'
  11. // `DASHES` will be right after the opening square bracket of the "character class"
  12. const DASHES = '-\u2010-\u2015\u2212\u30FC\uFF0D'
  13. const SLASHES = '\uFF0F/'
  14. const DOTS = '\uFF0E.'
  15. export const WHITESPACE = ' \u00A0\u00AD\u200B\u2060\u3000'
  16. const BRACKETS = '()\uFF08\uFF09\uFF3B\uFF3D\\[\\]'
  17. // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\['
  18. const TILDES = '~\u2053\u223C\uFF5E'
  19. // Regular expression of acceptable punctuation found in phone numbers. This
  20. // excludes punctuation found as a leading character only. This consists of dash
  21. // characters, white space characters, full stops, slashes, square brackets,
  22. // parentheses and tildes. Full-width variants are also present.
  23. export const VALID_PUNCTUATION = `${DASHES}${SLASHES}${DOTS}${WHITESPACE}${BRACKETS}${TILDES}`
  24. export const PLUS_CHARS = '+\uFF0B'
  25. // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')