import { IMiddlewareProvider , IMiddlewareClass } from '../types' ; import { DataUtility } from './data.utility' ; /**
 * ParserUtility functions to parse dino objects
 */ export abstract class DinoParser { /**
     * Parses the MiddlewareProvider to MiddlewareClass
     */ static parseMiddlewareProvider ( middleware ) { let middlewareFunction = middleware as any ; let data = undefined ; let middlewareClass = middleware as any ; if ( ! DataUtility . isFunction ( middleware ) && ! DataUtility . isUndefinedOrNull ( middlewareClass ) ) { if ( DataUtility . isFunction ( middlewareClass . useClass ) ) { middlewareFunction = middlewareClass . useClass ; data = middlewareClass . data ; } else { middlewareFunction = middlewareClass . useClass ; } } return { data : data , useClass : middlewareFunction } ; } }