insomnia/app/backend/previewModes.js

25 lines
645 B
JavaScript
Raw Normal View History

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