Comparing version 0.6.6 to 0.6.7
@@ -5,2 +5,14 @@ # Changelog | ||
### [0.6.7](https://github.com/nuxt-contrib/ufo/compare/v0.6.6...v0.6.7) (2021-02-22) | ||
### Features | ||
* isEmptyURL and isNonEmptyURL utils ([3c1c6d8](https://github.com/nuxt-contrib/ufo/commit/3c1c6d8ec83518805b451ffd76c49210acbb1a29)) | ||
### Bug Fixes | ||
* **joinURL, resolveURL:** ignore empty url parts ([c5fd74d](https://github.com/nuxt-contrib/ufo/commit/c5fd74d9bc3311a44e1be0635e7a4e62a7aea416)) | ||
### [0.6.6](https://github.com/nuxt-contrib/ufo/compare/v0.6.5...v0.6.6) (2021-02-10) | ||
@@ -7,0 +19,0 @@ |
@@ -129,2 +129,4 @@ /** | ||
declare function getQuery(input: string): QueryObject; | ||
declare function isEmptyURL(url: string): boolean; | ||
declare function isNonEmptyURL(url: string): boolean | ""; | ||
declare function joinURL(base: string, ...input: string[]): string; | ||
@@ -136,2 +138,2 @@ declare function createURL(input: string): $URL; | ||
export { $URL, ParsedAuth, ParsedHost, ParsedURL, QueryObject, QueryValue, cleanDoubleSlashes, createURL, decode, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isSamePath, joinURL, normalizeURL, parseAuth, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash }; | ||
export { $URL, ParsedAuth, ParsedHost, ParsedURL, QueryObject, QueryValue, cleanDoubleSlashes, createURL, decode, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isNonEmptyURL, isSamePath, joinURL, normalizeURL, parseAuth, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash }; |
@@ -286,3 +286,3 @@ 'use strict'; | ||
function withBase(input, base) { | ||
if (!base || base === "/") { | ||
if (isEmptyURL(base)) { | ||
return input; | ||
@@ -297,3 +297,3 @@ } | ||
function withoutBase(input, base) { | ||
if (!base || base === "/") { | ||
if (isEmptyURL(base)) { | ||
return input; | ||
@@ -316,9 +316,13 @@ } | ||
} | ||
function isEmptyURL(url2) { | ||
return !url2 || url2 === "/"; | ||
} | ||
function isNonEmptyURL(url2) { | ||
return url2 && url2 !== "/"; | ||
} | ||
function joinURL(base, ...input) { | ||
let url2 = base || ""; | ||
for (const i of input) { | ||
for (const i of input.filter(isNonEmptyURL)) { | ||
const part = withoutLeadingSlash(i); | ||
if (part !== "/") { | ||
url2 = withTrailingSlash(url2) + part; | ||
} | ||
url2 = withTrailingSlash(url2) + part; | ||
} | ||
@@ -335,3 +339,3 @@ return url2; | ||
const url2 = createURL(base); | ||
for (const i of input) { | ||
for (const i of input.filter(isNonEmptyURL)) { | ||
url2.append(createURL(i)); | ||
@@ -408,2 +412,4 @@ } | ||
exports.hasTrailingSlash = hasTrailingSlash; | ||
exports.isEmptyURL = isEmptyURL; | ||
exports.isNonEmptyURL = isNonEmptyURL; | ||
exports.isSamePath = isSamePath; | ||
@@ -410,0 +416,0 @@ exports.joinURL = joinURL; |
{ | ||
"name": "ufo", | ||
"version": "0.6.6", | ||
"version": "0.6.7", | ||
"description": "URL utils for humans", | ||
@@ -5,0 +5,0 @@ "repository": "nuxt-contrib/ufo", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42422
935