UNPKG

@onereach/channel-transformer

Version:

Convert data model between different channels (Slack, Microsoft Teams, Generic...)

20 lines (14 loc) 587 B
import { getKeyValue } from '../../../helpers/get-key-value'; import { getErrorObject } from '../../../helpers/get-error-object'; import { transformSection } from './items/section'; import { transformText } from './items/text'; import { transformImage } from './items/image'; const methods: { [key: string]: Function } = { section: transformSection, text: transformText, image: transformImage }; export const getMethods = (type: string): Function => { return getKeyValue(methods)(type) || getErrorObject({ type, message: 'Generic to Service Now' }); }; export { methods };