@jmespath-community/jmespath
Version:
Typescript implementation of the JMESPath Community specification
29 lines • 750 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScopeChain = void 0;
class ScopeChain {
constructor() {
this.inner = undefined;
this.data = {};
}
get currentScopeData() {
return this.data;
}
withScope(data) {
const outer = new ScopeChain();
outer.inner = this;
outer.data = data;
return outer;
}
getValue(identifier) {
if (Object.prototype.hasOwnProperty.call(this.data, identifier)) {
return this.data[identifier];
}
if (this.inner) {
return this.inner.getValue(identifier);
}
return null;
}
}
exports.ScopeChain = ScopeChain;
//# sourceMappingURL=Scope.js.map