@apiratorjs/async-context
Version:
A Node.js async context library leveraging the node:async_hooks module, supporting context merging and overriding.
21 lines • 599 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsyncContextStore = void 0;
class AsyncContextStore extends Map {
static fromObject(obj) {
const store = new AsyncContextStore();
for (const [key, value] of Object.entries(obj)) {
store.set(key, value);
}
return store;
}
toPlain() {
const obj = {};
for (const [key, value] of this.entries()) {
obj[key] = value;
}
return obj;
}
}
exports.AsyncContextStore = AsyncContextStore;
//# sourceMappingURL=types.js.map