diff --git a/src/lib/isISO6346.js b/src/lib/isISO6346.js index 2c28c1123..cb6ac7b32 100644 --- a/src/lib/isISO6346.js +++ b/src/lib/isISO6346.js @@ -3,7 +3,7 @@ import assertString from './util/assertString'; // https://en.wikipedia.org/wiki/ISO_6346 // according to ISO6346 standard, checksum digit is mandatory for freight container but recommended // for other container types (J and Z) -const isISO6346Str = /^[A-Z]{3}(U[0-9]{7})|([J,Z][0-9]{6,7})$/; +const isISO6346Str = /^[A-Z]{3}(U[0-9]{7}|[JZ][0-9]{6,7})$/; const isDigit = /^[0-9]$/; export function isISO6346(str) { diff --git a/src/lib/isRgbColor.js b/src/lib/isRgbColor.js index a672df279..c8272a05c 100644 --- a/src/lib/isRgbColor.js +++ b/src/lib/isRgbColor.js @@ -2,9 +2,9 @@ import assertString from './util/assertString'; const rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/; -const rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/; +const rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0(\.\d+)?|1(\.0+)?|\.\d+)\)$/; const rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/; -const rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/; +const rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0(\.\d+)?|1(\.0+)?|\.\d+)\)$/; const startsWithRgb = /^rgba?/; export default function isRgbColor(str, options) { diff --git a/src/lib/normalizeEmail.js b/src/lib/normalizeEmail.js index ceb252f34..f4349ac1e 100644 --- a/src/lib/normalizeEmail.js +++ b/src/lib/normalizeEmail.js @@ -14,7 +14,7 @@ const default_normalize_email_options = { gmail_remove_dots: true, // Removes the subaddress (e.g. "+foo") from the email address gmail_remove_subaddress: true, - // Conversts the googlemail.com domain to gmail.com + // Converts the googlemail.com domain to gmail.com gmail_convert_googlemaildotcom: true, // The following conversions are specific to Outlook.com / Windows Live / Hotmail diff --git a/test/validators.test.js b/test/validators.test.js index 9c867efae..ddcb811f1 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -5122,6 +5122,10 @@ describe('Validators', () => { 'rgb(5%,5%,5%)', 'rgba(5%,5%,5%,.3)', 'rgba(5%,5%,5%,.32)', + 'rgba(255,255,255,.123)', + 'rgba(5%,5%,5%,.321)', + 'rgba(0,0,0,1.00)', + 'rgba(0,0,0,0.12345)', ], invalid: [ 'rgb(0,0,0,)', @@ -5130,12 +5134,10 @@ describe('Validators', () => { 'rgb()', 'rgba(0,0,0)', 'rgba(255,255,255,2)', - 'rgba(255,255,255,.123)', 'rgba(255,255,256,0.1)', 'rgb(4,4,5%)', 'rgba(5%,5%,5%)', 'rgba(3,3,3%,.3)', - 'rgba(5%,5%,5%,.321)', 'rgb(101%,101%,101%)', 'rgba(3%,3%,101%,0.3)', 'rgb(101%,101%,101%) additional invalid string part', @@ -13542,6 +13544,11 @@ describe('Validators', () => { 'ECMJ4657496', 'TBJA7176445', 'AFFU5962593', + 'abcHLXU2008419', + 'HLXU2008419abc', + 'abcQJRZ123456', + 'QJRZ123456abc', + 'QJR,123456', ], }); }); @@ -13567,6 +13574,11 @@ describe('Validators', () => { 'ECMJ4657496', 'TBJA7176445', 'AFFU5962593', + 'abcHLXU2008419', + 'HLXU2008419abc', + 'abcQJRZ123456', + 'QJRZ123456abc', + 'QJR,123456', ], }); });