import { LegacyVars } from './types' ; const ELIGIBLE_FLAT_MERGE_KEYS = [ 'uiCapabilities' ] ; export function mergeVars ( ... sources ) { return Object . assign ( { } , ... sources , ... ELIGIBLE_FLAT_MERGE_KEYS . flatMap ( ( key ) => sources . some ( ( source ) => key in source ) ? [ { [ key ] : Object . assign ( { } , ... sources . map ( ( source ) => source [ key ] || { } ) ) } ] : [ ] ) ) ; }