forked from validatorjs/validator.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/chriso/validator.js
* 'master' of https://github.com/chriso/validator.js: Additional stuff for validatorjs#858 Fixed semicolon issue Fixed stuff using eslint Created includes function for array to cater older browsers Update the changelog and bundle Iraq locale added 10.4.0 Update the changelog and min version Squased commits, made changes to isIpRange to avoid array destructuring. Update the changelog chore: add tests and update readme Squashing the many disparit commits into a single commit. Bump Update the changelog and min version 10.3.0 Support German numbers without a separator after country code Code updated with test cases Adde Kuwait Number Regex for Mobile Number Validation Accepting array of locales for mobile phone validation # Conflicts: # validator.min.js
- Loading branch information
Showing
22 changed files
with
289 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
node_modules | ||
coverage | ||
package-lock.json | ||
yarn.lock | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = isIPRange; | ||
|
||
var _assertString = require('./util/assertString'); | ||
|
||
var _assertString2 = _interopRequireDefault(_assertString); | ||
|
||
var _isIP = require('./isIP'); | ||
|
||
var _isIP2 = _interopRequireDefault(_isIP); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var subnetMaybe = /^\d{1,2}$/; | ||
|
||
function isIPRange(str) { | ||
(0, _assertString2.default)(str); | ||
var parts = str.split('/'); | ||
|
||
// parts[0] -> ip, parts[1] -> subnet | ||
if (parts.length !== 2) { | ||
return false; | ||
} | ||
|
||
if (!subnetMaybe.test(parts[1])) { | ||
return false; | ||
} | ||
|
||
// Disallow preceding 0 i.e. 01, 02, ... | ||
if (parts[1].length > 1 && parts[1].startsWith('0')) { | ||
return false; | ||
} | ||
|
||
return (0, _isIP2.default)(parts[0], 4) && parts[1] <= 32 && parts[1] >= 0; | ||
} | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var includes = function includes(arr, val) { | ||
return arr.some(function (arrVal) { | ||
return val === arrVal; | ||
}); | ||
}; | ||
|
||
exports.default = includes; | ||
module.exports = exports["default"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import assertString from './util/assertString'; | ||
import isIP from './isIP'; | ||
|
||
const subnetMaybe = /^\d{1,2}$/; | ||
|
||
export default function isIPRange(str) { | ||
assertString(str); | ||
const parts = str.split('/'); | ||
|
||
// parts[0] -> ip, parts[1] -> subnet | ||
if (parts.length !== 2) { | ||
return false; | ||
} | ||
|
||
if (!subnetMaybe.test(parts[1])) { | ||
return false; | ||
} | ||
|
||
// Disallow preceding 0 i.e. 01, 02, ... | ||
if (parts[1].length > 1 && parts[1].startsWith('0')) { | ||
return false; | ||
} | ||
|
||
return isIP(parts[0], 4) && parts[1] <= 32 && parts[1] >= 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const includes = (arr, val) => arr.some(arrVal => val === arrVal); | ||
|
||
export default includes; |
Oops, something went wrong.