New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hreftypes

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hreftypes

Figure out what type a href is. Useful to help resolve URI's between assets on a site

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
429
decreased by-53.52%
Maintainers
2
Weekly downloads
 
Created
Source

Hreftypes

NPM version Build Status Coverage Status Dependency Status

Hreftypes helps you determine if a href is of type absolute, protocolRelative, rootRelative, relative or inline. This can be useful while resolving URI's across different types of assets in a website dependency graph.

Installation

npm install --save- hreftypes

Usage

const assert = require('assert');
const { hrefTypes, getHrefType } = require('hreftype');

assert(getHrefType('http://foo.com') === hrefTypes.ABSOLUTE);
assert(getHrefType('https://foo.com') === hrefTypes.ABSOLUTE);
assert(getHrefType('//foo.com') === hrefTypes.PROTOCOL_RELATIVE);
assert(getHrefType('/foo.com') === hrefTypes.ROOT_RELATIVE);
assert(getHrefType('foo.com') === hrefTypes.RELATIVE);
assert(getHrefType('data:text/html,<h1>Hi</h1>') === hrefTypes.INLINE);

License

BSD 3-Clause License

Keywords

FAQs

Package last updated on 29 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc