move logic below

This commit is contained in:
Simon Knott 2024-09-02 08:42:12 +02:00
parent 2d7ae24de9
commit 1af4bc0b5d
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -265,8 +265,9 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {
get(target: Object, matcherName: string | symbol, receiver: any): any {
let matcher = Reflect.get(target, matcherName, receiver);
if (typeof matcherName !== 'string')
return matcher;
if (typeof matcherName === 'string') {
for (const prefix of this._prefixes) {
for (let i = prefix.length; i > 0; i--) {
const qualifiedName = qualifiedMatcherName(prefix.slice(0, i), matcherName);
@ -276,10 +277,7 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {
}
}
}
}
if (typeof matcherName !== 'string')
return matcher;
if (matcher === undefined)
throw new Error(`expect: Property '${matcherName}' not found.`);
if (typeof matcher !== 'function') {