From 4b5780a217ec197cdc839d88ab7a0418c4d3475a Mon Sep 17 00:00:00 2001 From: Keelan Murphy Date: Tue, 21 Apr 2020 21:43:58 +0100 Subject: [PATCH 1/2] Allow passing of function to .matches() --- src/string.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/string.js b/src/string.js index 23079be3e..032f85caf 100644 --- a/src/string.js +++ b/src/string.js @@ -77,6 +77,7 @@ inherits(StringSchema, MixedSchema, { if (options) { if (typeof options === 'string') message = options; + if (typeof options === 'function') message = options; if (typeof options === 'object') { ({ excludeEmptyString, message, name } = options); } From 22d3fe0ad4496a86c04e59822c49c3e121cd8852 Mon Sep 17 00:00:00 2001 From: Keelan Murphy Date: Wed, 22 Apr 2020 14:42:53 +0100 Subject: [PATCH 2/2] No strict type checking --- src/string.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/string.js b/src/string.js index 032f85caf..e2103f565 100644 --- a/src/string.js +++ b/src/string.js @@ -76,10 +76,10 @@ inherits(StringSchema, MixedSchema, { let name; if (options) { - if (typeof options === 'string') message = options; - if (typeof options === 'function') message = options; if (typeof options === 'object') { ({ excludeEmptyString, message, name } = options); + } else { + message = options; } }