mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-16 23:50:02 -04:00
chore: more code cleanup
This commit is contained in:
parent
f022024291
commit
a5a99ea188
3 changed files with 38 additions and 27 deletions
|
@ -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];
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue