@availity/resolve-url
Advanced tools
Comparing version 1.1.21 to 1.1.22
@@ -6,2 +6,10 @@ # Change Log | ||
## 1.1.22 (2021-10-22) | ||
**Note:** Version bump only for package @availity/resolve-url | ||
## 1.1.21 (2021-05-17) | ||
@@ -8,0 +16,0 @@ |
@@ -8,2 +8,3 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
Object.defineProperty(exports, "isAbsoluteUrl", { | ||
@@ -21,3 +22,2 @@ enumerable: true, | ||
}); | ||
exports["default"] = void 0; | ||
@@ -24,0 +24,0 @@ var _resolveUrl = _interopRequireDefault(require("./resolve-url")); |
@@ -8,2 +8,3 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
Object.defineProperty(exports, "isAbsoluteUrl", { | ||
@@ -15,3 +16,2 @@ enumerable: true, | ||
}); | ||
exports["default"] = void 0; | ||
@@ -18,0 +18,0 @@ var _isAbsoluteUrl = _interopRequireDefault(require("./is-absolute-url")); |
{ | ||
"name": "@availity/resolve-url", | ||
"version": "1.1.21", | ||
"version": "1.1.22", | ||
"description": "Resolve absolute url from relative urls", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "4e1d7493ccf0ba9e776476efc86088f4324618cd" | ||
"gitHead": "a247c20c27816eb3e3b68b983d12631a6cadd72b" | ||
} |
@@ -15,3 +15,3 @@ # resolve-url | ||
```bash | ||
$ npm install @availity/resolve-url | ||
npm install @availity/resolve-url | ||
``` | ||
@@ -22,5 +22,5 @@ | ||
```bash | ||
$ yarn add @availity/resolve-url | ||
yarn add @availity/resolve-url | ||
``` | ||
## [Documentation](https://availity.github.io/sdk-js/resources/resolve-url) |
// Borrowed from https://github.com/rubensworks/relative-to-absolute-iri.js but refactored to work with IE11. | ||
function isCharacterAllowedAfterRelativePathSegment(character) { | ||
return ( | ||
!character || character === '#' || character === '?' || character === '/' | ||
); | ||
return !character || character === '#' || character === '?' || character === '/'; | ||
} | ||
@@ -168,5 +166,3 @@ | ||
if (baseColonPos < 0) { | ||
throw new Error( | ||
`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'` | ||
); | ||
throw new Error(`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'`); | ||
} | ||
@@ -189,11 +185,6 @@ | ||
if (baseIRI.length > baseColonPos + 3) { | ||
return `${baseIRI}/${removeDotSegmentsOfPath( | ||
relativeIRI, | ||
valueColonPos | ||
)}`; | ||
return `${baseIRI}/${removeDotSegmentsOfPath(relativeIRI, valueColonPos)}`; | ||
} | ||
return ( | ||
baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos) | ||
); | ||
return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos); | ||
} | ||
@@ -207,6 +198,3 @@ } else { | ||
if (baseIRI.length > baseColonPos + 1) { | ||
return `${baseIRI}/${removeDotSegmentsOfPath( | ||
relativeIRI, | ||
valueColonPos | ||
)}`; | ||
return `${baseIRI}/${removeDotSegmentsOfPath(relativeIRI, valueColonPos)}`; | ||
} | ||
@@ -219,5 +207,3 @@ | ||
if (relativeIRI.indexOf('/') === 0) { | ||
return ( | ||
baseIRI.substr(0, baseSlashAfterColonPos) + removeDotSegments(relativeIRI) | ||
); | ||
return baseIRI.substr(0, baseSlashAfterColonPos) + removeDotSegments(relativeIRI); | ||
} | ||
@@ -229,15 +215,7 @@ | ||
// Ignore everything after the last '/' in the baseIRI path | ||
if ( | ||
baseIRILastSlashPos >= 0 && | ||
baseIRILastSlashPos < baseIRIPath.length - 1 | ||
) { | ||
if (baseIRILastSlashPos >= 0 && baseIRILastSlashPos < baseIRIPath.length - 1) { | ||
baseIRIPath = baseIRIPath.substr(0, baseIRILastSlashPos + 1); | ||
// Also remove the first character of the relative path if it starts with '.' (and not '..' or './') | ||
// This change is only allowed if there is something else following the path | ||
if ( | ||
relativeIRI[0] === '.' && | ||
relativeIRI[1] !== '.' && | ||
relativeIRI[1] !== '/' && | ||
relativeIRI[2] | ||
) { | ||
if (relativeIRI[0] === '.' && relativeIRI[1] !== '.' && relativeIRI[1] !== '/' && relativeIRI[2]) { | ||
relativeIRI = relativeIRI.substr(1); | ||
@@ -244,0 +222,0 @@ } |
declare function removeDotSegments(path: string): string; | ||
declare function removeDotSegmentsOfPath( | ||
iri: string, | ||
colonPosition: number | ||
): string; | ||
declare function removeDotSegmentsOfPath(iri: string, colonPosition: number): string; | ||
declare function resolve(relativeIRI: string, baseIRI: string): boolean; | ||
@@ -7,0 +4,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
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
0
28348
16
496