import { OptionalFactory , OptionalPool } from '../interfaces' ; export class Optional implements OptionalFactory { private optionalPool : OptionalPool = { } ; create ( name ) { this . optionalPool [ name ] = { value : null , } ; } patch ( name , factory ) { this . optionalPool [ name ] = { value : factory } ; } link ( name ) { return ( this . optionalPool [ name ] || { value : null } ) . value ; } has ( name ) { return ! ! this . optionalPool [ name ] ; } }