UNPKG

@onereach/channel-transformer

Version:

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

24 lines (19 loc) 749 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'; import { transformOptions } from './items/select'; const methods: { [key: string]: Function } = { section: transformSection, text: transformText, image: transformImage, button: transformOptions, select: transformOptions, radio: transformOptions, checkbox: transformOptions }; export const getMethods = (type: string): Function => { return getKeyValue(methods)(type) || getErrorObject({ type, message: 'Generic to Salesforce' }); }; export { methods };