UNPKG

surrogate

Version:

Object method hooks made easy

29 lines 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Context = void 0; const constants_1 = require("../constants"); class Context { constructor(target, receiver, event, original, originalArguments) { this.target = target; this.receiver = receiver; this.event = event; this.original = original; this.originalArguments = originalArguments; } determineContext(options) { const { useContext } = options; return this.useInstance(useContext) ? this.target : this.useSurrogate(useContext) ? this.receiver : useContext; } useInstance(context) { return context === constants_1.SurrogateContext.Instance; } useSurrogate(context) { return context === constants_1.SurrogateContext.Surrogate; } } exports.Context = Context; //# sourceMappingURL=index.js.map