import AbstractFactory from './AbstractFactory.ts' import {DependencyRequirement} from '../type/DependencyRequirement.ts' import {Collection} from '../../../lib/src/collection/Collection.ts' /** * Container factory that produces an item by calling the token as a function. * @extends AbstractFactory */ export default class FunctionFactory extends AbstractFactory { constructor( /** * The name identifying this factory in the container. * @type {string} */ protected name: string, /** * The token, which is a function that returns the value of this factory. * @type {function} */ protected token: () => any, ) { super(token) } get_dependency_keys(): Collection { return new Collection() } match(something: any) { return something === this.name } produce(dependencies: any[], parameters: any[]): any { return this.token() } }