import { Event } from './event' ; param data function transformEvent ( data ) { if ( ! data || ! data . properties || ! data . properties . products ) { return data ; } const newProducts = { } ; const products = data . properties . products ; Object . keys ( products ) . forEach ( type => { const newType = type . replace ( '-scenario' , '' ) ; newProducts [ newType ] = products [ type ] ; if ( newType !== type ) { newProducts [ newType ] . forEach ( product => { product . type = newType ; } ) ; } } ) ; data . properties . products = newProducts ; return data ; } /**
 * Child class for scenario events, returns a new event object and calls on
 * the parent Event constructor
 */ export class ScenarioEvent extends Event { constructor ( data ) { const newData = transformEvent ( data ) ; super ( newData ) ; } }