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 (15 loc) 355 B
'use strict' module.exports = (path) => { const { existsSync } = require('fs') var allowedFileType = ['txt', 'json', 'xml'] var fileType = path.toLowerCase().split('.').pop() if (existsSync(path)) { return 'file' } else { if (allowedFileType.includes(fileType)) { return 'online-file' } else { return 'url' } } }