import { IApiTreeRoot } from "../explorer/IApiTreeRoot" ; import { IOperationTreeRoot } from "../explorer/IOperationTreeRoot" ; import { IProductTreeRoot } from "../explorer/IProductTreeRoot" ; import { IServiceTreeRoot } from "../explorer/IServiceTreeRoot" ; export function nameUtil ( root ) { let name = root . serviceName ; if ( isProductRoot ( root ) ) { name = `${ name }-${ root . productName }` ; } if ( isApiRoot ( root ) ) { name = `${ name }-${ root . apiName }` ; } if ( isOperationRoot ( root ) ) { name = `${ name }-${ root . opName }` ; } return name ; } function isApiRoot ( root ) { return ( < IApiTreeRoot > root ) . apiName !== undefined ; } function isOperationRoot ( root ) { return ( < IOperationTreeRoot > root ) . opName !== undefined ; } function isProductRoot ( root ) { return ( < IProductTreeRoot > root ) . productName !== undefined ; }