chore: more code cleanup

This commit is contained in:
Percs 2024-12-09 13:21:17 -06:00
parent f022024291
commit a5a99ea188
3 changed files with 38 additions and 27 deletions

View file

@ -125,19 +125,19 @@ export class ScramjetClient {
{
get: (target, prop: string) => {
if (prop in target) {
return target[prop];
} else {
const split = prop.split(".");
const realProp = split.pop();
const realTarget = split.reduce((a, b) => a?.[b], this.global);
if (!realTarget) return;
const original = Reflect.get(realTarget, realProp);
target[prop] = original;
return target[prop];
}
const split = prop.split(".");
const realProp = split.pop();
const realTarget = split.reduce((a, b) => a?.[b], this.global);
if (!realTarget) return;
const original = Reflect.get(realTarget, realProp);
target[prop] = original;
return target[prop];
},
}
);
@ -146,22 +146,19 @@ export class ScramjetClient {
{
get: (target, prop: string) => {
if (prop in target) {
return target[prop];
} else {
const split = prop.split(".");
const realProp = split.pop();
const realTarget = split.reduce((a, b) => a?.[b], this.global);
if (!realTarget) return;
const original = nativeGetOwnPropertyDescriptor(
realTarget,
realProp
);
target[prop] = original;
return target[prop];
}
const split = prop.split(".");
const realProp = split.pop();
const realTarget = split.reduce((a, b) => a?.[b], this.global);
if (!realTarget) return;
const original = nativeGetOwnPropertyDescriptor(realTarget, realProp);
target[prop] = original;
return target[prop];
},
}
);