UNPKG

alpha-dic

Version:

Asynchronous dependency injection container

66 lines (65 loc) 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Lookup = void 0; class Lookup { } exports.Lookup = Lookup; (function (Lookup) { class ByServiceName extends Lookup { constructor(name) { super(); this.name = name; Object.freeze(this); } find(container) { const result = container.findByName(this.name); return result ? result : []; } toString() { return 'by service name: ' + this.name.toString(); } } Lookup.ByServiceName = ByServiceName; class ByAnnotation extends Lookup { constructor(predicate) { super(); this.predicate = predicate; Object.freeze(this); } find(container) { return container.findByAnnotation(this.predicate); } toString() { return 'by annotation predicate'; } } Lookup.ByAnnotation = ByAnnotation; class ByPredicate extends Lookup { constructor(predicate) { super(); this.predicate = predicate; Object.freeze(this); } find(container) { return container.findByPredicate(this.predicate); } toString() { return 'by service predicate'; } } Lookup.ByPredicate = ByPredicate; class ByType extends Lookup { constructor(type) { super(); this.type = type; Object.freeze(this); } find(container) { return container.findByPredicate(this.type.predicate); } toString() { return 'by type: ' + this.type.toString(); } } Lookup.ByType = ByType; })(Lookup = exports.Lookup || (exports.Lookup = {}));