37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// CONSTANTS
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
const TITLE_ERROR = 'error';
|
|
const TITLE_MESSAGE = 'message';
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// PRIVATE FUNCTIONS
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
function buildGenericMessage(nameMessage, textMessage) {
|
|
const jsonMessageResult = {};
|
|
jsonMessageResult[nameMessage] = textMessage;
|
|
return jsonMessageResult;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// PUBLIC FUNCTIONS
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
function buildErrorMessage(text) {
|
|
return buildGenericMessage(TITLE_ERROR, text)
|
|
}
|
|
|
|
function buildMessage(text) {
|
|
return buildGenericMessage(TITLE_MESSAGE, text)
|
|
}
|
|
|
|
module.exports = {
|
|
buildErrorMessage,
|
|
buildMessage,
|
|
//For testing
|
|
buildGenericMessage
|
|
} |