Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: validatorjs/validator.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0a9b52d818e459d4942c22a630f657b2f01ad976
Choose a base ref
...
head repository: validatorjs/validator.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c0b905e994ff2d8259eac06bbdbb07152486458c
Choose a head ref
Loading
Showing with 3,202 additions and 1,472 deletions.
  1. +13 −0 .babelrc
  2. +1 −0 .eslintrc.json
  3. +1 −1 .gitignore
  4. +0 −1 .travis.yml
  5. +101 −0 CHANGELOG.md
  6. +1 −1 LICENSE
  7. +38 −15 README.md
  8. +16 −10 build-browser.js
  9. +158 −277 index.js
  10. +31 −18 lib/alpha.js
  11. +7 −7 lib/blacklist.js
  12. +8 −10 lib/contains.js
  13. +6 −6 lib/equals.js
  14. +6 −6 lib/escape.js
  15. +9 −12 lib/isAfter.js
  16. +10 −8 lib/isAlpha.js
  17. +10 −8 lib/isAlphanumeric.js
  18. +6 −6 lib/isAscii.js
  19. +8 −6 lib/isBase64.js
  20. +9 −12 lib/isBefore.js
  21. +6 −6 lib/isBoolean.js
  22. +13 −12 lib/isByteLength.js
  23. +16 −9 lib/isCreditCard.js
  24. +24 −27 lib/isCurrency.js
  25. +15 −10 lib/isDataURI.js
  26. +15 −14 lib/isDecimal.js
  27. +8 −10 lib/isDivisibleBy.js
  28. +47 −27 lib/isEmail.js
  29. +14 −7 lib/isEmpty.js
  30. +24 −15 lib/isFQDN.js
  31. +11 −8 lib/isFloat.js
  32. +6 −7 lib/isFullWidth.js
  33. +6 −7 lib/isHalfWidth.js
  34. +7 −7 lib/isHash.js
  35. +6 −6 lib/isHexColor.js
  36. +6 −6 lib/isHexadecimal.js
  37. +17 −12 lib/isIP.js
  38. +37 −0 lib/isIPRange.js
  39. +16 −8 lib/isISBN.js
  40. +13 −9 lib/isISIN.js
  41. +8 −6 lib/isISO31661Alpha2.js
  42. +8 −6 lib/isISO31661Alpha3.js
  43. +44 −9 lib/isISO8601.js
  44. +6 −6 lib/isISRC.js
  45. +10 −7 lib/isISSN.js
  46. +61 −0 lib/isIdentityCard.js
  47. +16 −15 lib/isIn.js
  48. +9 −12 lib/isInt.js
  49. +14 −11 lib/isJSON.js
  50. +20 −0 lib/isJWT.js
  51. +12 −12 lib/isLatLong.js
  52. +13 −12 lib/isLength.js
  53. +6 −6 lib/isLowercase.js
  54. +13 −7 lib/isMACAddress.js
  55. +6 −6 lib/isMD5.js
  56. +20 −0 lib/isMagnetURI.js
  57. +8 −9 lib/isMimeType.js
  58. +47 −20 lib/isMobilePhone.js
  59. +8 −10 lib/isMongoId.js
  60. +6 −6 lib/isMultibyte.js
  61. +13 −7 lib/isNumeric.js
  62. +9 −6 lib/isPort.js
  63. +29 −25 lib/isPostalCode.js
  64. +12 −18 lib/isRFC3339.js
  65. +6 −6 lib/isSurrogatePair.js
  66. +36 −31 lib/isURL.js
  67. +6 −7 lib/isUUID.js
  68. +6 −6 lib/isUppercase.js
  69. +8 −8 lib/isVariableWidth.js
  70. +8 −6 lib/isWhitelisted.js
  71. +7 −7 lib/ltrim.js
  72. +8 −6 lib/matches.js
  73. +26 −25 lib/normalizeEmail.js
  74. +11 −9 lib/rtrim.js
  75. +8 −10 lib/stripLow.js
  76. +8 −6 lib/toBoolean.js
  77. +6 −6 lib/toDate.js
  78. +6 −6 lib/toFloat.js
  79. +6 −6 lib/toInt.js
  80. +7 −9 lib/trim.js
  81. +6 −6 lib/unescape.js
  82. +22 −3 lib/util/assertString.js
  83. +17 −0 lib/util/includes.js
  84. +7 −3 lib/util/merge.js
  85. +8 −5 lib/util/toString.js
  86. +7 −7 lib/whitelist.js
  87. +20 −12 package.json
  88. +18 −5 src/index.js
  89. +11 −2 src/lib/alpha.js
  90. +2 −0 src/lib/isAlpha.js
  91. +2 −0 src/lib/isAlphanumeric.js
  92. +2 −1 src/lib/isDecimal.js
  93. +17 −2 src/lib/isEmail.js
  94. +9 −2 src/lib/isEmpty.js
  95. +2 −0 src/lib/isFloat.js
  96. +25 −0 src/lib/isIPRange.js
  97. +2 −1 src/lib/isISO31661Alpha2.js
  98. +2 −1 src/lib/isISO31661Alpha3.js
  99. +37 −3 src/lib/isISO8601.js
  100. +51 −0 src/lib/isIdentityCard.js
  101. +8 −0 src/lib/isJWT.js
  102. +5 −1 src/lib/isMACAddress.js
  103. +8 −0 src/lib/isMagnetURI.js
  104. +33 −11 src/lib/isMobilePhone.js
  105. +5 −1 src/lib/isNumeric.js
  106. +2 −0 src/lib/isPostalCode.js
  107. +8 −2 src/lib/isURL.js
  108. +12 −1 src/lib/util/assertString.js
  109. +3 −0 src/lib/util/includes.js
  110. +3 −3 test/client-side.js
  111. +27 −3 test/exports.js
  112. +2 −2 test/sanitizers.js
  113. +765 −132 test/validators.js
  114. +745 −280 validator.js
  115. +2 −2 validator.min.js
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
["@babel/preset-env", {"targets": {"node": "0.10"}}]
],
"plugins": [
[
"add-module-exports",
{
"addDefaultProperty": true
}
]
]
}
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "airbnb-base",
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@
node_modules
coverage
package-lock.json
yarn.lock
yarn.lock
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,5 @@ language: node_js
node_js:
- stable
- 8
- 6
notifications:
email: false
101 changes: 101 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
#### 10.11.0

- Fix imports like `import .. from "validator/lib/.."`
([#961](https://github.com/chriso/validator.js/pull/961))
- New locale
([#958](https://github.com/chriso/validator.js/pull/958))

#### 10.10.0

- `isISO8601()` strict mode now works in the browser
([#932](https://github.com/chriso/validator.js/pull/932))
- New and improved locales
([#931](https://github.com/chriso/validator.js/pull/931),
[#933](https://github.com/chriso/validator.js/pull/933),
[#947](https://github.com/chriso/validator.js/pull/947),
[#950](https://github.com/chriso/validator.js/pull/950))

#### 10.9.0

- Added an option to `isURL()` to reject email-like URLs
([#901](https://github.com/chriso/validator.js/pull/901))
- Added a `strict` option to `isISO8601()`
([#910](https://github.com/chriso/validator.js/pull/910))
- Relaxed `isJWT()` signature requirements
([#906](https://github.com/chriso/validator.js/pull/906))
- New and improved locales
([#899](https://github.com/chriso/validator.js/pull/899),
[#904](https://github.com/chriso/validator.js/pull/904),
[#913](https://github.com/chriso/validator.js/pull/913),
[#916](https://github.com/chriso/validator.js/pull/916),
[#925](https://github.com/chriso/validator.js/pull/925),
[#928](https://github.com/chriso/validator.js/pull/928))

#### 10.8.0

- Added `isIdentityCard()`
([#846](https://github.com/chriso/validator.js/pull/846))
- Better error when validators are passed an invalid type
([#895](https://github.com/chriso/validator.js/pull/895))
- Locales are now exported
([#890](https://github.com/chriso/validator.js/pull/890),
[#892](https://github.com/chriso/validator.js/pull/892))
- New locale
([#896](https://github.com/chriso/validator.js/pull/896))

#### 10.7.1

- Ignore case when checking URL protocol
([#887](https://github.com/chriso/validator.js/issues/887))
- Locale fix
([#889](https://github.com/chriso/validator.js/pull/889))

#### 10.7.0

- Added `isMagnetURI()` to validate [magnet URIs](https://en.wikipedia.org/wiki/Magnet_URI_scheme)
([#884](https://github.com/chriso/validator.js/pull/884))
- Added `isJWT()` to validate [JSON web tokens](https://en.wikipedia.org/wiki/JSON_Web_Token)
([#885](https://github.com/chriso/validator.js/pull/885))

#### 10.6.0

- Updated `isMobilePhone()` to match any locale's pattern by default
([#874](https://github.com/chriso/validator.js/pull/874))
- Added an option to ignore whitespace in `isEmpty()`
([#880](https://github.com/chriso/validator.js/pull/880))
- New and improved locales
([#878](https://github.com/chriso/validator.js/pull/878),
[#879](https://github.com/chriso/validator.js/pull/879))

#### 10.5.0

- Disabled domain-specific email validation
([#873](https://github.com/chriso/validator.js/pull/873))
- Added support for IP hostnames in `isEmail()`
([#845](https://github.com/chriso/validator.js/pull/845))
- Added a `no_symbols` option to `isNumeric()`
([#848](https://github.com/chriso/validator.js/pull/848))
- Added a `no_colons` option to `isMACAddress()`
([#849](https://github.com/chriso/validator.js/pull/849))
- Updated `isURL()` to reject protocol relative URLs unless a flag is set
([#860](https://github.com/chriso/validator.js/issues/860))
- New and improved locales
([#801](https://github.com/chriso/validator.js/pull/801),
[#856](https://github.com/chriso/validator.js/pull/856),
[#859](https://github.com/chriso/validator.js/issues/859),
[#861](https://github.com/chriso/validator.js/pull/861),
[#862](https://github.com/chriso/validator.js/pull/862),
[#863](https://github.com/chriso/validator.js/pull/863),
[#864](https://github.com/chriso/validator.js/pull/864),
[#870](https://github.com/chriso/validator.js/pull/870),
[#872](https://github.com/chriso/validator.js/pull/872))

#### 10.4.0

- Added an `isIPRange()` validator
([#842](https://github.com/chriso/validator.js/pull/842))
- Accept an array of locales in `isMobilePhone()`
([#742](https://github.com/chriso/validator.js/pull/742))
- New locale
([#843](https://github.com/chriso/validator.js/pull/843))

#### 10.3.0

- Strict Gmail validation in `isEmail()`
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016 Chris O'Hara <cohara87@gmail.com>
Copyright (c) 2018 Chris O'Hara <cohara87@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Loading