surrogate
Version:
Object method hooks made easy
35 lines (28 loc) • 1.4 kB
JavaScript
import {HandlerRunner as $3759c83d5e65e080$export$60ce066c927074a9} from "./surrogate.432c697b.js";
import {OptionsHandler as $cd88bf3e08824493$export$8bcac92dafadbaee} from "./surrogate.cafd13cf.js";
import {isFunction as $8c13fb1fbdc14b86$export$f6e2535fb5126e54} from "./surrogate.68fc8564.js";
class $3faa7dcc5b883ee7$export$89c285f228afdc27 {
constructor(handler, type, options = new (0, $cd88bf3e08824493$export$8bcac92dafadbaee)()){
this.handler = handler;
this.type = type;
this.options = options;
}
getHandler(context) {
const { target: target, receiver: receiver } = context;
return this.shouldReflect(this.handler) ? this.shouldReflectSurrogate(context) ? /**
* @note Removes ability to apply target only
* @todo fix ^^
*/ Reflect.get(receiver, this.handler, receiver) : Reflect.get(target, this.handler, receiver) : this.handler;
}
shouldReflect(value) {
return !(0, $8c13fb1fbdc14b86$export$f6e2535fb5126e54)(value);
}
shouldReflectSurrogate(context) {
return context.useSurrogate(this.options.useContext);
}
getHandlerRunner(node) {
return (0, $3759c83d5e65e080$export$60ce066c927074a9).for(node, this.options);
}
}
export {$3faa7dcc5b883ee7$export$89c285f228afdc27 as BaseContainer};
//# sourceMappingURL=surrogate.76cdb317.js.map