UNPKG

access-sniff

Version:

A node/iojs library & CLI for HTML_Codesniffer

46 lines (35 loc) 1.23 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _underscore = require('underscore'); var _underscore2 = _interopRequireDefault(_underscore); var _getElementPosition = require('./getElementPosition'); var _getElementPosition2 = _interopRequireDefault(_getElementPosition); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var buildMessage = function buildMessage(msg, fileContents, options) { var msgSplit = msg.split('|'); var message = void 0; // If the level type is ignored, then return null; if (_underscore2.default.contains(options.ignore, msgSplit[1])) { return message; } // Start the Logging if the the report level matches if (_underscore2.default.contains(options.reportLevelsArray, msgSplit[0])) { message = { heading: msgSplit[0], issue: msgSplit[1], description: msgSplit[2], position: (0, _getElementPosition2.default)(msgSplit[3], fileContents), element: { node: msgSplit[3], class: msgSplit[4], id: msgSplit[5] } }; } // Return the message for reports return message; }; exports.default = buildMessage;