insomnia/app/backend/previewModes.js

23 lines
574 B
JavaScript
Raw Normal View History

export const PREVIEW_MODE_FRIENDLY = 'friendly';
export const PREVIEW_MODE_SOURCE = 'source';
export const PREVIEW_MODE_RAW = 'raw';
2016-09-21 00:03:26 +00:00
const previewModeMap = {
[PREVIEW_MODE_FRIENDLY]: 'Visual',
[PREVIEW_MODE_SOURCE]: 'Source',
[PREVIEW_MODE_RAW]: 'Raw'
2016-09-21 00:03:26 +00:00
};
export const PREVIEW_MODES = Object.keys(previewModeMap);
2016-09-21 00:03:26 +00:00
/**
* Get the friendly name for a given preview mode
*
* @param previewMode
* @returns {*|string}
*/
export function getPreviewModeName (previewMode) {
2016-09-21 00:03:26 +00:00
// TODO: Make this more robust maybe...
return previewModeMap[previewMode] || 'Unknown';
}