Skip to content

Commit

Permalink
Updates for #849
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Jul 31, 2018
1 parent 755c4c5 commit 4082b06
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
([#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))
- 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 @@ -100,7 +100,7 @@ Validator | Description
**isLatLong(str)**                     | check if the string is a valid latitude-longitude coordinate in the format `lat,long` or `lat, long`.
**isLength(str [, options])** | check if the string's length falls in a range.<br/><br/>`options` is an object which defaults to `{min:0, max: undefined}`. Note: this function takes into account surrogate pairs.
**isLowercase(str)** | check if the string is lowercase.
**isMACAddress(str)** | check if the string is a MAC address.<br/><br/>`options` is an object which defaults to `{noColons: false}`, meaning that it will only validate MAC addresses containing 5 colons.
**isMACAddress(str)** | check if the string is a MAC address.<br/><br/>`options` is an object which defaults to `{no_colons: false}`. If `no_colons` is true, the validator will allow MAC addresses without the colons.
**isMD5(str)** | check if the string is a MD5 hash.
**isMimeType(str)** | check if the string matches to a valid [MIME type](https://en.wikipedia.org/wiki/Media_type) format
**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 `+`.
Expand Down
2 changes: 1 addition & 1 deletion lib/isMACAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var macAddressNoColons = /^([0-9a-fA-F]){12}$/;

function isMACAddress(str, options) {
(0, _assertString2.default)(str);
if (options && options.noColons) {
if (options && options.no_colons) {
return macAddressNoColons.test(str);
}
return macAddress.test(str);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/isMACAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const macAddressNoColons = /^([0-9a-fA-F]){12}$/;

export default function isMACAddress(str, options) {
assertString(str);
if (options && options.noColons) {
if (options && options.no_colons) {
return macAddressNoColons.test(str);
}
return macAddress.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 @@ -615,7 +615,7 @@ describe('Validators', () => {
test({
validator: 'isMACAddress',
args: [{
noColons: true,
no_colons: true,
}],
valid: [
'abababababab',
Expand Down
2 changes: 1 addition & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ var macAddressNoColons = /^([0-9a-fA-F]){12}$/;

function isMACAddress(str, options) {
assertString(str);
if (options && options.noColons) {
if (options && options.no_colons) {
return macAddressNoColons.test(str);
}
return macAddress.test(str);
Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit 4082b06

Please sign in to comment.