@7c/validurl 中文文档教程
validURL
验证 URL 是一项棘手的工作。 有很多方法。 这是我的自由主义方法。
Features
- supports any protocols (https|http|ftp|arbitrary)://
- supports ipv6 hostnames
- supports punycode urls
- tested against 1.3M URLs
Testing
测试可能需要一段时间,因为我们要针对 130 万个 URL 进行测试。 测试文件仅在 github clone 上可用。 对于 npm 包,它们将被忽略。
npm run test
Install
npm i --save @7c/validurl
Usage
const validURL = require('@7c/validurl')
console.log(validURL('http://localhost'))
欢迎各种错误报告
validURL
validating URLs is tricky job. There are tons of approaches. This is my liberal approach.
Features
- supports any protocols (https|http|ftp|arbitrary)://
- supports ipv6 hostnames
- supports punycode urls
- tested against 1.3M URLs
Testing
testing might take a while, since we are testing against 1.3Million URLs. Test files are only available at github clone. They will be ignored for npm package.
npm run test
Install
npm i --save @7c/validurl
Usage
const validURL = require('@7c/validurl')
console.log(validURL('http://localhost'))
All kind of bugreports are welcome