import { walkStep } from "../walk" ; import { WalkNode } from "../node" ; export function reduce < T > ( source , initialValue , fn ) { let val = initialValue ; for ( let node of walkStep ( source ) ) val = fn ( val , node ) ; return val ; }