import { Inject , Service } from 'typedi' ; import { Property } from '@mockingbird/reflect' ; import { Callback , Faker } from '@mockingbird/common' ; import { ValueHandler } from '../types/value-handler.interface' ; @ Service ( ) export class CallbackValueHandler implements ValueHandler { public constructor ( @ Inject ( 'Faker' ) private readonly faker ) { } public shouldHandle ( property ) { return property . decoratorValue . isCallback ( ) && ( property . decoratorValue . value as Callback ) . name === '' ; } public produceValue ( property ) { return ( property . decoratorValue . value as Callback ) ( this . faker ) ; } }