react-obsidian
Version:
Dependency injection framework for React and React Native applications
17 lines • 559 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
class PropsInjector {
constructor(graph) {
this.graph = graph;
}
inject(passedProps) {
// eslint-disable-next-line prefer-object-spread
return new Proxy(Object.assign({}, passedProps), {
get: (target, p, receiver) => {
return p in target ? Reflect.get(target, p, receiver) : this.graph.retrieve(p, receiver);
},
});
}
}
exports.default = PropsInjector;
//# sourceMappingURL=PropsInjector.js.map
;