superdesk/superdesk-client-core

View on GitHub
scripts/apps/authoring/preview/isMediaField.ts

Summary

Maintainability
A
0 mins
Test Coverage
import {IAuthoringField} from 'superdesk-api';
import {assertNever} from 'core/helpers/typescript-helpers';

export function isMediaField(field: IAuthoringField) {
    switch (field.type) {
    case 'plain-text':
    case 'html':
    case 'subjects':
    case 'vocabulary-values':
    case 'urls':
    case 'related-articles':
    case 'attachments':
    case 'custom':
        return false;
    case 'media-gallery':
    case 'embed':
        return true;
    default:
        assertNever(field);
    }
}