import Promise from "../utils/promise" ; param { List < Article > } articles param { Function return { Promise } function walkArticles ( articles , fn ) { return Promise . forEach ( articles , ( article ) => { return Promise ( fn ( article ) ) . then ( ( ) => { return walkArticles ( article . getArticles ( ) , fn ) ; } ) ; } ) ; } param { Summary } summary param { Function return { Promise } function walkSummary ( summary , fn ) { const parts = summary . getParts ( ) ; return Promise . forEach ( parts , ( part ) => { return walkArticles ( part . getArticles ( ) , fn ) ; } ) ; } export default walkSummary ;