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: 748d4999ceb23a90f6c61b9cbdb1bc957e59ec92
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: 24b3fd3309d1057dd87af3a568def0db01dbaade
Choose a head ref
Loading
Showing with 11,053 additions and 6,292 deletions.
  1. +24 −0 .babelrc
  2. +0 −2 .eslintignore
  3. +18 −3 .eslintrc.json
  4. +1 −0 .github/FUNDING.yml
  5. +20 −0 .github/ISSUE_TEMPLATE/bug_report.md
  6. +12 −0 .github/pull_request_template.md
  7. +33 −0 .github/workflows/ci.yml
  8. +24 −0 .github/workflows/npm-publish.yml
  9. +8 −1 .gitignore
  10. +9 −0 .nycrc
  11. +0 −8 .travis.yml
  12. +587 −146 CHANGELOG.md
  13. +1 −1 LICENSE
  14. +91 −33 README.md
  15. +1 −1 bower.json
  16. +16 −10 build-browser.js
  17. +0 −351 index.js
  18. +0 −96 lib/alpha.js
  19. +0 −18 lib/blacklist.js
  20. +0 −22 lib/contains.js
  21. +0 −18 lib/equals.js
  22. +0 −18 lib/escape.js
  23. +0 −26 lib/isAfter.js
  24. +0 −25 lib/isAlpha.js
  25. +0 −25 lib/isAlphanumeric.js
  26. +0 −22 lib/isAscii.js
  27. +0 −25 lib/isBase64.js
  28. +0 −26 lib/isBefore.js
  29. +0 −18 lib/isBoolean.js
  30. +0 −33 lib/isByteLength.js
  31. +0 −45 lib/isCreditCard.js
  32. +0 −92 lib/isCurrency.js
  33. +0 −49 lib/isDataURI.js
  34. +0 −41 lib/isDecimal.js
  35. +0 −22 lib/isDivisibleBy.js
  36. +0 −89 lib/isEmail.js
  37. +0 −18 lib/isEmpty.js
  38. +0 −61 lib/isFQDN.js
  39. +0 −25 lib/isFloat.js
  40. +0 −20 lib/isFullWidth.js
  41. +0 −20 lib/isHalfWidth.js
  42. +0 −35 lib/isHash.js
  43. +0 −20 lib/isHexColor.js
  44. +0 −20 lib/isHexadecimal.js
  45. +0 −81 lib/isIP.js
  46. +0 −57 lib/isISBN.js
  47. +0 −48 lib/isISIN.js
  48. +0 −21 lib/isISO31661Alpha2.js
  49. +0 −23 lib/isISO8601.js
  50. +0 −21 lib/isISRC.js
  51. +0 −58 lib/isISSN.js
  52. +0 −39 lib/isIn.js
  53. +0 −33 lib/isInt.js
  54. +0 −25 lib/isJSON.js
  55. +0 −23 lib/isLatLong.js
  56. +0 −34 lib/isLength.js
  57. +0 −18 lib/isLowercase.js
  58. +0 −20 lib/isMACAddress.js
  59. +0 −20 lib/isMD5.js
  60. +0 −52 lib/isMimeType.js
  61. +0 −103 lib/isMobilePhone.js
  62. +0 −22 lib/isMongoId.js
  63. +0 −22 lib/isMultibyte.js
  64. +0 −20 lib/isNumeric.js
  65. +0 −17 lib/isPort.js
  66. +0 −76 lib/isPostalCode.js
  67. +0 −20 lib/isSurrogatePair.js
  68. +0 −147 lib/isURL.js
  69. +0 −28 lib/isUUID.js
  70. +0 −18 lib/isUppercase.js
  71. +0 −22 lib/isVariableWidth.js
  72. +0 −23 lib/isWhitelisted.js
  73. +0 −19 lib/ltrim.js
  74. +0 −21 lib/matches.js
  75. +0 −129 lib/normalizeEmail.js
  76. +0 −25 lib/rtrim.js
  77. +0 −23 lib/stripLow.js
  78. +0 −21 lib/toBoolean.js
  79. +0 −19 lib/toDate.js
  80. +0 −18 lib/toFloat.js
  81. +0 −18 lib/toInt.js
  82. +0 −21 lib/trim.js
  83. +0 −18 lib/unescape.js
  84. +0 −14 lib/util/assertString.js
  85. +0 −18 lib/util/merge.js
  86. +0 −22 lib/util/toString.js
  87. +0 −18 lib/whitelist.js
  88. +33 −21 package.json
  89. +0 −9 src/.eslintrc.json
  90. +69 −7 src/index.js
  91. +43 −7 src/lib/alpha.js
  92. +10 −2 src/lib/contains.js
  93. +18 −2 src/lib/isAlpha.js
  94. +18 −2 src/lib/isAlphanumeric.js
  95. +17 −0 src/lib/isBIC.js
  96. +12 −0 src/lib/isBase32.js
  97. +12 −0 src/lib/isBase58.js
  98. +15 −2 src/lib/isBase64.js
  99. +14 −0 src/lib/isBtcAddress.js
  100. +1 −1 src/lib/isCreditCard.js
  101. +2 −1 src/lib/isCurrency.js
  102. +4 −3 src/lib/isDataURI.js
  103. +58 −0 src/lib/isDate.js
  104. +2 −1 src/lib/isDecimal.js
  105. +75 −0 src/lib/isEAN.js
  106. +106 −8 src/lib/isEmail.js
  107. +9 −2 src/lib/isEmpty.js
  108. +8 −0 src/lib/isEthereumAddress.js
  109. +34 −12 src/lib/isFQDN.js
  110. +7 −4 src/lib/isFloat.js
  111. +19 −0 src/lib/isHSL.js
  112. +1 −1 src/lib/isHash.js
  113. +1 −1 src/lib/isHexColor.js
  114. +1 −1 src/lib/isHexadecimal.js
  115. +137 −0 src/lib/isIBAN.js
  116. +50 −0 src/lib/isIMEI.js
  117. +49 −50 src/lib/isIP.js
  118. +47 −0 src/lib/isIPRange.js
  119. +40 −17 src/lib/isISIN.js
  120. +3 −1 src/lib/isISO31661Alpha2.js
  121. +27 −0 src/lib/isISO31661Alpha3.js
  122. +36 −3 src/lib/isISO8601.js
  123. +4 −6 src/lib/isISSN.js
  124. +342 −0 src/lib/isIdentityCard.js
  125. +2 −0 src/lib/isIn.js
  126. +13 −2 src/lib/isJSON.js
  127. +15 −0 src/lib/isJWT.js
  128. +17 −1 src/lib/isLatLong.js
  129. +1 −1 src/lib/isLength.js
  130. +30 −0 src/lib/isLicensePlate.js
  131. +11 −0 src/lib/isLocale.js
  132. +13 −3 src/lib/isMACAddress.js
  133. +8 −0 src/lib/isMagnetURI.js
  134. +93 −17 src/lib/isMobilePhone.js
  135. +7 −3 src/lib/isNumeric.js
  136. +8 −0 src/lib/isOctal.js
  137. +76 −0 src/lib/isPassportNumber.js
  138. +35 −5 src/lib/isPostalCode.js
  139. +27 −0 src/lib/isRFC3339.js
  140. +19 −0 src/lib/isRgbColor.js
  141. +20 −0 src/lib/isSemVer.js
  142. +8 −0 src/lib/isSlug.js
  143. +97 −0 src/lib/isStrongPassword.js
  144. +1,216 −0 src/lib/isTaxID.js
  145. +35 −3 src/lib/isURL.js
  146. +16 −0 src/lib/isVAT.js
  147. +2 −1 src/lib/ltrim.js
  148. +32 −4 src/lib/normalizeEmail.js
  149. +3 −8 src/lib/rtrim.js
  150. +2 −2 src/lib/toBoolean.js
  151. +3 −2 src/lib/toFloat.js
  152. +97 −0 src/lib/util/algorithms.js
  153. +6 −2 src/lib/util/assertString.js
  154. +3 −0 src/lib/util/includes.js
  155. +13 −0 src/lib/util/multilineRegex.js
  156. +10 −0 src/lib/util/typeOf.js
  157. +0 −15 test/.eslintrc.json
  158. +17 −15 test/client-side.js
  159. +41 −14 test/exports.js
  160. +119 −42 test/sanitizers.js
  161. +20 −0 test/util.js
  162. +6,749 −1,425 test/validators.js
  163. +0 −1,560 validator.js
  164. +0 −23 validator.min.js
24 changes: 24 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"es": {
"presets": [
["@babel/preset-env", {
"modules": false
}]
]
},
"development": {
"presets": [
["@babel/preset-env", { "targets": { "node": "0.10" } }]
],
"plugins": [
[
"add-module-exports",
{
"addDefaultProperty": true
}
]
]
}
}
}
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

21 changes: 18 additions & 3 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"
@@ -11,15 +12,29 @@
"mocha": true
},
"rules": {
"camelcase": [0],
"no-param-reassign": [0],
"camelcase": 0,
"no-param-reassign": 0,
"one-var": 0,
"one-var-declaration-per-line": 0,
"func-names": 0,
"no-console": 0,
"newline-per-chained-call": 0,
"prefer-const": 0,
"linebreak-style": 0,
"no-restricted-syntax": [2, "DebuggerStatement", "LabeledStatement", "WithStatement"]
"no-restricted-syntax": [2, "DebuggerStatement", "LabeledStatement", "WithStatement"],
"no-restricted-globals": 0,
"prefer-destructuring": 0,
"comma-dangle": [2, {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}],
"no-plusplus": [2, {
"allowForLoopAfterthoughts": true
}],
"no-prototype-builtins": 0,
"no-useless-escape": 0
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: validatorjs
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: "\U0001F41B bug"
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.


**Examples**
If applicable, add screenshots to help explain your problem.

**Additional context**
Validator.js version:
Node.js version:
OS platform: [windows, linux, macOS, etc]
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
Add a descriptive title textbox above, e.g.
feat(validatorName): brief title of what has been done
-->

{{ briefly describe what you have done in this PR }}

## Checklist

- [ ] PR contains only changes related; no stray files, etc.
- [ ] README updated (where applicable)
- [ ] Tests written (where applicable)
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [14, 12, 10, 8, 6]
name: Run tests on Node.js ${{ matrix.node-version }}
steps:
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
- if: matrix.node-version == 14
name: Generate coverage file
run: npm run test:ci > coverage.lcov
- if: matrix.node-version == 14
name: Send coverage info to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.lcov
24 changes: 24 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: NPM Publish
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- name: Setup Node.js 14
uses: actions/setup-node@v2-beta
with:
node-version: 14
check-latest: true
registry-url: https://registry.npmjs.org/
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Dependencies
run: npm install
- name: Run Tests
run: npm test
- name: Publish Package to NPM Registry
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
.DS_Store
node_modules
coverage
coverage.lcov
.nyc_output
package-lock.json
yarn.lock
yarn.lock
/es
/lib
/index.js
validator.js
validator.min.js
9 changes: 9 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"reporter": [
"html",
"text-summary"
],
"include": [
"src/**/*.js"
]
}
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

Loading