import { PartialReducer } from '../types/types' ; /**
 * Performs the same computation as `reduce`, but yields the value of the
 * accumulator after each iteration.
 */ export const scanIterable = ( reducer , seed ? ) => function * ( source ) : IterableIterator < unknown > { let accumulator = seed ; for ( const value of source ) { const nextAccumulator = accumulator === undefined ? value : reducer ( accumulator , value ) ; if ( nextAccumulator === undefined ) { return ; } yield ( accumulator = nextAccumulator ) ; } return accumulator ; } ;