import deviceType from '../config/deviceType'; import Link from './Link'; import Section from './Section'; const mapShape = {}; mapShape[deviceType.Link] = Link; mapShape[deviceType.Section] = Section; function shapefactory(device) { let shape = mapShape[device.type]; if (shape instanceof Function) { return shape(device); } } export default shapefactory