import { ApiListNode , FlattenedApiList } from './interfaces' ; import { isStable } from './helpers' ; export param { ApiListNode [ ] } apiList requires returns { FlattenedApiList } todo export function flattenApiList ( apiList ) { return apiList . reduce ( ( acc , curr ) : FlattenedApiList => { return { ... acc , ... curr . items . reduce ( ( acc , curr ) : FlattenedApiList => { if ( isStable ( curr . stability ) ) { return { ... acc , [ curr . title ] : { path : curr . path , docType : curr . docType } } ; } return { ... acc } ; } , { } as FlattenedApiList ) } ; } , { } as FlattenedApiList ) ; }