url-extension-validator
Methods for validating URL web page extensions (ending in .aspx, .php, .htm, .html ...)
Check if the supplied URL ends in a known web page extension or not. The valid extensions list can be overridden for custom use cases.
Table of Contents
Install
npm install --save url-extension-validator
Usage
const UrlExtensionValidator = ; const validator = ;
To check if a URL ends in a valid web page extension
const validUrl = validator; // => true
To check if a web page extension is valid or not
const validExtension = validator; // => trueconst alsoValid = validator; // => true
To return an array of valid web page extensions for any use case (i.e. custom map, filter or reduce functions)
const validExtensions = UrlExtensionValidator; // => ['.asp', '.aspx', ...]
To return a simple map of valid web page extensions
const validExtensionMap = validator; // => { '.asp': true, '.aspx': true, ... }
To wrap any method in a promise
validator
To override the valid extensions list
const validator = extensionsList: '.htm' '.html' '.btc' ; const validExtension = validator; // => false
Maintainers
Contributing
Small note: If editing the README, please conform to the standard-readme specification.
License
MIT © 2019 njhoran