@availity/resolve-url
Advanced tools
Comparing version 1.1.21-alpha.21 to 1.1.21
@@ -6,2 +6,13 @@ # Change Log | ||
## 1.1.21 (2021-05-17) | ||
### Bug Fixes | ||
* **resolve-url:** fixes incorrect regex results failing tests, assign default param to baseIRI ([2aebb4b](https://github.com/Availity/sdk-js/commit/2aebb4b5ac512b8be1818a97914b84e6b734b1da)) | ||
## 1.1.20 (2020-06-22) | ||
@@ -8,0 +19,0 @@ |
@@ -12,4 +12,5 @@ "use strict"; | ||
throw new TypeError("Expected a `string`, got `".concat(typeof url, "`")); | ||
} | ||
} // eslint-disable-next-line unicorn/better-regex | ||
return /^[a-z][a-z\d+.-]*:/.test(url); | ||
@@ -16,0 +17,0 @@ }; |
@@ -84,3 +84,3 @@ "use strict"; | ||
// Query and fragment string should be appended unchanged | ||
if (!segmentBuffers.length > 0) { | ||
if (segmentBuffers.length === 0) { | ||
segmentBuffers.push([]); | ||
@@ -96,3 +96,3 @@ } | ||
// Not a special character, just append it to our buffer | ||
if (!segmentBuffers.length > 0) { | ||
if (segmentBuffers.length === 0) { | ||
segmentBuffers.push([]); | ||
@@ -153,4 +153,4 @@ } | ||
function resolve(relativeIRI, baseIRI) { | ||
baseIRI = baseIRI || ''; | ||
function resolve(relativeIRI) { | ||
var baseIRI = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var baseFragmentPos = baseIRI.indexOf('#'); // Ignore any fragments in the base IRI | ||
@@ -163,3 +163,3 @@ | ||
if (!relativeIRI.length > 0) { | ||
if (relativeIRI.length === 0) { | ||
return baseIRI; | ||
@@ -185,3 +185,3 @@ } // If the value starts with a query character, concat directly (but strip the existing query) | ||
if (!baseIRI.length > 0) { | ||
if (baseIRI.length === 0) { | ||
return removeDotSegmentsOfPath(relativeIRI, relativeIRI.indexOf(':')); | ||
@@ -188,0 +188,0 @@ } // Ignore baseIRI if the value is absolute |
{ | ||
"name": "@availity/resolve-url", | ||
"version": "1.1.21-alpha.21+a2b3164", | ||
"version": "1.1.21", | ||
"description": "Resolve absolute url from relative urls", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "a2b31645b933229b33935f4ff16aa299ec4a25af" | ||
"gitHead": "4e1d7493ccf0ba9e776476efc86088f4324618cd" | ||
} |
// Borrowed from https://github.com/sindresorhus/is-absolute-url to make IE11 compatible | ||
const isAbsoluteUrl = url => { | ||
const isAbsoluteUrl = (url) => { | ||
if (typeof url !== 'string') { | ||
@@ -7,2 +7,3 @@ throw new TypeError(`Expected a \`string\`, got \`${typeof url}\``); | ||
// eslint-disable-next-line unicorn/better-regex | ||
return /^[a-z][a-z\d+.-]*:/.test(url); | ||
@@ -9,0 +10,0 @@ }; |
@@ -69,3 +69,3 @@ // Borrowed from https://github.com/rubensworks/relative-to-absolute-iri.js but refactored to work with IE11. | ||
// Query and fragment string should be appended unchanged | ||
if (!segmentBuffers.length > 0) { | ||
if (segmentBuffers.length === 0) { | ||
segmentBuffers.push([]); | ||
@@ -79,3 +79,3 @@ } | ||
// Not a special character, just append it to our buffer | ||
if (!segmentBuffers.length > 0) { | ||
if (segmentBuffers.length === 0) { | ||
segmentBuffers.push([]); | ||
@@ -89,3 +89,3 @@ } | ||
return `/${segmentBuffers.map(buffer => buffer.join('')).join('/')}`; | ||
return `/${segmentBuffers.map((buffer) => buffer.join('')).join('/')}`; | ||
} | ||
@@ -130,4 +130,3 @@ | ||
*/ | ||
export function resolve(relativeIRI, baseIRI) { | ||
baseIRI = baseIRI || ''; | ||
export function resolve(relativeIRI, baseIRI = '') { | ||
const baseFragmentPos = baseIRI.indexOf('#'); | ||
@@ -141,3 +140,3 @@ | ||
// Convert empty value directly to base IRI | ||
if (!relativeIRI.length > 0) { | ||
if (relativeIRI.length === 0) { | ||
return baseIRI; | ||
@@ -161,3 +160,3 @@ } | ||
// Ignore baseIRI if it is empty | ||
if (!baseIRI.length > 0) { | ||
if (baseIRI.length === 0) { | ||
return removeDotSegmentsOfPath(relativeIRI, relativeIRI.indexOf(':')); | ||
@@ -164,0 +163,0 @@ } |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
49231
1