import { Stream , merge } from 'most' ; export function mergeObjects < A extends { readonly [ key ] : Stream < any > ; } > ( ... objs ) { if ( objs . length === 1 ) return objs [ 0 ] ; const mergedObject = { } as A ; objs . forEach ( ( obj ) => { const keys = Object . keys ( obj ) ; keys . forEach ( ( key ) => { const value = obj [ key ] ; if ( ! mergedObject [ key ] ) mergedObject [ key ] = value ; else mergedObject [ key ] = merge ( mergedObject [ key ] , value ) ; } ) ; } ) ; return mergedObject ; }