async-injection
Version:
A robust lightweight dependency injection library for TypeScript.
25 lines • 710 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InjectionToken = void 0;
/**
* Allow for implicit typing of constants and interfaces.
* Inspired by Angular and some colleges at work.
*/
class InjectionToken {
constructor(id) {
this.id = id;
}
get description() {
return this.toString();
}
toString() {
// noinspection SuspiciousTypeOfGuard
if (typeof this.id === 'symbol') {
const desc = this.id.description;
return desc !== undefined ? desc : this.id.toString();
}
return this.id.toString();
}
}
exports.InjectionToken = InjectionToken;
//# sourceMappingURL=injector.js.map