href-type
Version:
Test whether an href string is absolute, relative, protocol-relative, #fragment, mailto:, tel:, sms:, etc
48 lines (31 loc) • 1.04 kB
Markdown
Test whether an href string is absolute, relative, protocol-relative,
```sh
npm install href-type --save
```
```js
const hrefType = require('href-type')
hrefType('mailto:zeke@sikelianos.com') // mailto
hrefType('tel:+15054592942') // tel
hrefType('sms:+15054592942') // sms
hrefType('https://example.com') // absolute
hrefType('http://example.com') // absolute
hrefType('irc://irc.example.com') // protocol
hrefType('/foo/bar.html') // rooted
hrefType('baz/qux.css') // relative
```
```sh
npm install
npm test
```
None
- [chai](https://github.com/chaijs/chai): BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- [mocha](https://github.com/mochajs/mocha): simple, flexible, fun test framework
MIT
_Generated by [package-json-to-readme](https://github.com/zeke/package-json-to-readme)_