diff --git a/src/lib/util/assertString.js b/src/lib/util/assertString.js index 6a4737b4b..e4fac8854 100644 --- a/src/lib/util/assertString.js +++ b/src/lib/util/assertString.js @@ -1,5 +1,7 @@ export default function assertString(input) { - if (typeof input !== 'string') { + const isString = (typeof input === 'string' || input instanceof String); + + if (!isString) { throw new TypeError('This library (validator.js) validates strings only'); } }