Skip to content

Commit

Permalink
Updates for #848
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Jul 31, 2018
1 parent 0f4877b commit c192d7c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#### HEAD

- Support for IP hostnames in `isEmail()`
- 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))
- New and improved locales
([#856](https://github.com/chriso/validator.js/pull/856),
[#870](https://github.com/chriso/validator.js/pull/870),
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Validator | Description
**isMobilePhone(str, locale [, options])** | check if the string is a mobile phone number,<br/><br/>(locale is either an array of locales (e.g `['sk-SK', 'sr-RS']`) OR one of `['ar-AE', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY', 'bg-BG', 'bn-BD', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-HK', 'en-IN', 'en-KE', 'en-NG', 'en-NZ', 'en-RW', 'en-SG', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'en-PK', 'es-ES', 'et-EE', 'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hu-HU', 'it-IT', 'ja-JP', 'kk-KZ', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'pt-BR', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-TW']` OR 'any'. If 'any' is used, function will check if any of the locales match).<br/><br/>`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`.
**isMongoId(str)** | check if the string is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid].
**isMultibyte(str)** | check if the string contains one or more multibyte chars.
**isNumeric(str [, options])** | check if the string contains only numbers.<br/><br/>`options` is an object which defaults to `{noSymbols: false}`, meaning that it will validate strings that do contain any of `+`, `-`, or `.`.
**isNumeric(str [, options])** | check if the string contains only numbers.<br/><br/>`options` is an object which defaults to `{no_symbols: false}`. If `no_symbols` is true, the validator will reject numeric strings that feature a symbol (e.g. `+`, `-`, or `.`).
**isPort(str)** | check if the string is a valid port number.
**isPostalCode(str, locale)** | check if the string is a postal code,<br/><br/>(locale is one of `[ 'AT', 'AU', 'BE', 'BG', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IL', 'IN', 'IS', 'IT', 'JP', 'KE', 'LI', 'LT', 'LU', 'LV', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SA', 'SE', 'SI', 'TN', 'TW', 'US', 'ZA', 'ZM' ]` OR 'any'. If 'any' is used, function will check if any of the locals match. locale list is `validator.isPostalCodeLocales`.).
**isSurrogatePair(str)** | check if the string contains any surrogate pairs chars.
Expand Down
2 changes: 1 addition & 1 deletion lib/isNumeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var numericNoSymbols = /^[0-9]+$/;

function isNumeric(str, options) {
(0, _assertString2.default)(str);
if (options && options.noSymbols) {
if (options && options.no_symbols) {
return numericNoSymbols.test(str);
}
return numeric.test(str);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/isNumeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const numericNoSymbols = /^[0-9]+$/;

export default function isNumeric(str, options) {
assertString(str);
if (options && options.noSymbols) {
if (options && options.no_symbols) {
return numericNoSymbols.test(str);
}
return numeric.test(str);
Expand Down
2 changes: 1 addition & 1 deletion test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ describe('Validators', () => {
test({
validator: 'isNumeric',
args: [{
noSymbols: true,
no_symbols: true,
}],
valid: [
'123',
Expand Down
2 changes: 1 addition & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ var numericNoSymbols = /^[0-9]+$/;

function isNumeric(str, options) {
assertString(str);
if (options && options.noSymbols) {
if (options && options.no_symbols) {
return numericNoSymbols.test(str);
}
return numeric.test(str);
Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit c192d7c

Please sign in to comment.