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

ufo

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ufo - npm Package Compare versions

Comparing version 0.6.7 to 0.6.8

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.6.8](https://github.com/nuxt-contrib/ufo/compare/v0.6.7...v0.6.8) (2021-03-05)
### Features
* **hasProtocol:** optionally allow protocol relative url ([#16](https://github.com/nuxt-contrib/ufo/issues/16)) ([81a3f3e](https://github.com/nuxt-contrib/ufo/commit/81a3f3e9f203fb27869ea7d3d0e99f256d33e968))
### [0.6.7](https://github.com/nuxt-contrib/ufo/compare/v0.6.6...v0.6.7) (2021-02-22)

@@ -7,0 +14,0 @@

2

dist/index.d.ts

@@ -117,3 +117,3 @@ /**

declare function hasProtocol(inputStr: string): boolean;
declare function hasProtocol(inputStr: string, acceptProtocolRelative?: boolean): boolean;
declare function hasTrailingSlash(input?: string): boolean;

@@ -120,0 +120,0 @@ declare function withoutTrailingSlash(input?: string): string;

@@ -261,4 +261,4 @@ 'use strict';

function hasProtocol(inputStr) {
return /^\w+:\/\//.test(inputStr);
function hasProtocol(inputStr, acceptProtocolRelative = false) {
return /^\w+:\/\/.+/.test(inputStr) || acceptProtocolRelative && /^\/\/[^/]+/.test(inputStr);
}

@@ -347,6 +347,6 @@ function hasTrailingSlash(input = "") {

function parseURL(input = "") {
if (!hasProtocol(input)) {
if (!hasProtocol(input, true)) {
return parsePath(input);
}
const [protocol, auth, hostAndPath] = (input.match(/([^:/]+:)\/\/([^/@]+@)?(.*)/) || []).splice(1);
const [protocol = "", auth, hostAndPath] = (input.match(/([^:/]+:)?\/\/([^/@]+@)?(.*)/) || []).splice(1);
const [host = "", path = ""] = (hostAndPath.match(/([^/]*)(.*)?/) || []).splice(1);

@@ -353,0 +353,0 @@ const {pathname, search, hash} = parsePath(path);

{
"name": "ufo",
"version": "0.6.7",
"version": "0.6.8",
"description": "URL utils for humans",

@@ -5,0 +5,0 @@ "repository": "nuxt-contrib/ufo",

Sorry, the diff of this file is not supported yet

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