Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iso-url

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iso-url - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

4

changelog.md

@@ -0,1 +1,5 @@

# [0.4.0](https://github.com/hugomrdias/iso-url/compare/v0.3.0...v0.4.0) (2018-12-15)
# [0.3.0](https://github.com/hugomrdias/iso-url/compare/v0.2.0...v0.3.0) (2018-12-13)

@@ -2,0 +6,0 @@

@@ -38,2 +38,16 @@ 'use strict';

const relative = (
url,
base = defaultBase,
protocolMap = {},
defaultProtocol
) => {
const b = new URLWithLegacySupport(base);
const protocolBase = b.protocol;
b.protocol = protocolMap[protocolBase] || b.protocol || defaultProtocol;
return new URLWithLegacySupport(url, b.toString());
};
module.exports = {

@@ -43,3 +57,4 @@ URL: URLWithLegacySupport,

defaultBase,
format
format,
relative
};

@@ -27,6 +27,20 @@ 'use strict';

const relative = (url, location = {}, protocolMap = {}, defaultProtocol) => {
let protocol = location.protocol ?
location.protocol.replace(':', '') :
'http';
// Check protocol map
protocol = (protocolMap[protocol] || defaultProtocol || protocol) + ':';
const b = Object.assign({}, location, { protocol });
return new URLWithLegacySupport(url, format(b)).toString();
};
module.exports = {
URL: URLWithLegacySupport,
URLSearchParams,
format
format,
relative
};

3

package.json
{
"name": "iso-url",
"version": "0.3.0",
"version": "0.4.0",
"description": "Isomorphic/Universal WHATWG URL API with some support legacy node URL API",

@@ -36,3 +36,2 @@ "repository": "hugomrdias/iso-url",

"airtap": "^0.1.0",
"ava": "^0.25.0",
"codecov": "^3.1.0",

@@ -39,0 +38,0 @@ "conventional-changelog-cli": "^2.0.11",

@@ -16,3 +16,3 @@ # iso-url [![NPM Version](https://img.shields.io/npm/v/iso-url.svg)](https://www.npmjs.com/package/iso-url) [![NPM Downloads](https://img.shields.io/npm/dt/iso-url.svg)](https://www.npmjs.com/package/iso-url) [![NPM License](https://img.shields.io/npm/l/iso-url.svg)](https://www.npmjs.com/package/iso-url) [![Build Status](https://travis-ci.org/hugomrdias/iso-url.svg?branch=master)](https://travis-ci.org/hugomrdias/iso-url) [![codecov](https://codecov.io/gh/hugomrdias/iso-url/badge.svg?branch=master)](https://codecov.io/gh/hugomrdias/iso-url?branch=master)

```js
const { URL, URLSearchParams } = require('iso-url');
const { URL, URLSearchParams, format, relative } = require('iso-url');

@@ -25,3 +25,3 @@ const url = new isoUrl('http://localhost/unicorns');

### isoUrl(url, [base])
### new URL(url, [base])

@@ -41,4 +41,12 @@ #### input

### format(url, [options])
Same as https://nodejs.org/api/url.html#url_url_format_url_options
### relative(url, [location], [protocalMap], [defaultProtocol])
Same as https://github.com/dominictarr/relative-url but doesn't support this syntax `'//:9999'`
## License
MIT © [Hugo Dias](http://hugodias.me)
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