UNPKG

site-validator-cli

Version:

A command line tool that takes a URL or a file, then uses html-validator (a wrapper for https://validator.w3.org/nu/) to validate each page.

18 lines (16 loc) 525 B
'use strict' module.exports = (result) => { const parseError = (msg) => { var firstLine = msg.firstLine || msg.lastLine var lastLine = msg.lastLine || msg.firstLine var firstCol = msg.firstColumn || msg.lastColumn var lastCol = msg.lastColumn || msg.firstColumn return { type: msg.subType || msg.type, message: msg.message, location: `From line ${firstLine}, column ${firstCol}; ` + `to line ${lastLine}, column ${lastCol}` } } return result.map(parseError) }