We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fa1e3a commit ba3c7aeCopy full SHA for ba3c7ae
1 file changed
src/lib/util/assertString.js
@@ -1,4 +1,4 @@
1
export default function assertString(input) {
2
if (input === undefined || input === null) throw new TypeError(`Expected a string but received a ${input}`);
3
- if (input.constructor.name !== 'String') throw new TypeError(`Expected a string but received a ${input.constructor.name}`);
+ if (typeof input !== 'string' && !(input instanceof String)) throw new TypeError(`Expected a string but received a ${input?.constructor?.name ?? typeof input}`)
4
}
0 commit comments