UNPKG

@onereach/channel-transformer

Version:

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

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