@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
15 lines (13 loc) • 590 B
text/typescript
import { getKeyValue } from '../../../helpers/get-key-value';
import { getErrorObject } from '../../../helpers/get-error-object';
import { transformFileUpload } from './items/attachments';
import { transformText } from './items/text';
import { transformSection } from './items/section';
export const methods: {[key: string]: Function} = {
section: transformSection,
attachments: transformFileUpload,
text: transformText,
};
export const getMethods = (type: string): Function => {
return getKeyValue(methods)(type) || getErrorObject({ type, message: 'Generic to SMS' });
};