import type { Fn } from "@thi.ng/api" ; import type { ReductionFn } from "../api.js" ; import { isReduced } from "../reduced.js" ; param buf param complete param reduce internal export const __drain = < T > ( buf , complete , reduce ) => ( acc ) => { while ( buf . length && ! isReduced ( acc ) ) { acc = reduce ( acc , buf . shift ( ) ! ) ; } return complete ( acc ) ; } ;