@availity/resolve-url
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.1.5](https://github.com/Availity/sdk-js/compare/@availity/resolve-url@1.1.4...@availity/resolve-url@1.1.5) (2020-02-12) | ||
### Bug Fixes | ||
* **resolve-url:** fixed import ([b5a8077](https://github.com/Availity/sdk-js/commit/b5a807736bde15744f399ea822797c541fef8880)) | ||
## [1.1.4](https://github.com/Availity/sdk-js/compare/@availity/resolve-url@1.1.3...@availity/resolve-url@1.1.4) (2020-01-23) | ||
@@ -8,0 +19,0 @@ |
@@ -1,29 +0,5 @@ | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "isAbsoluteUrl", { | ||
enumerable: true, | ||
get: function () { | ||
return _isAbsoluteUrl.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "relativeToAbsolute", { | ||
enumerable: true, | ||
get: function () { | ||
return _relativeToAbsolute.default; | ||
} | ||
}); | ||
exports.default = void 0; | ||
var _resolveUrl = _interopRequireDefault(require("./resolve-url")); | ||
var _isAbsoluteUrl = _interopRequireDefault(require("./is-absolute-url")); | ||
var _relativeToAbsolute = _interopRequireDefault(require("./relative-to-absolute")); | ||
var _default = _resolveUrl.default; | ||
exports.default = _default; | ||
import resolveUrl from './resolve-url'; | ||
import isAbsoluteUrl from './is-absolute-url'; | ||
import { resolve as relativeToAbsolute } from './relative-to-absolute'; | ||
export default resolveUrl; | ||
export { isAbsoluteUrl, relativeToAbsolute }; |
@@ -1,12 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
// Borrowed from https://github.com/sindresorhus/is-absolute-url to make IE11 compatible | ||
const isAbsoluteUrl = url => { | ||
var isAbsoluteUrl = function isAbsoluteUrl(url) { | ||
if (typeof url !== 'string') { | ||
throw new TypeError(`Expected a \`string\`, got \`${typeof url}\``); | ||
throw new TypeError("Expected a `string`, got `".concat(typeof url, "`")); | ||
} | ||
@@ -17,3 +10,2 @@ | ||
var _default = isAbsoluteUrl; | ||
exports.default = _default; | ||
export default isAbsoluteUrl; |
@@ -1,10 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.removeDotSegments = removeDotSegments; | ||
exports.removeDotSegmentsOfPath = removeDotSegmentsOfPath; | ||
exports.resolve = resolve; | ||
// Borrowed from https://github.com/rubensworks/relative-to-absolute-iri.js but refactored to work with IE11. | ||
@@ -22,7 +13,7 @@ function isCharacterAllowedAfterRelativePathSegment(character) { | ||
function removeDotSegments(path) { | ||
export function removeDotSegments(path) { | ||
// Prepare a buffer with segments between each '/. | ||
// Each segment represents an array of characters. | ||
const segmentBuffers = []; | ||
let i = 0; | ||
var segmentBuffers = []; | ||
var i = 0; | ||
@@ -100,3 +91,5 @@ while (i < path.length) { | ||
return `/${segmentBuffers.map(buffer => buffer.join('')).join('/')}`; | ||
return "/".concat(segmentBuffers.map(function (buffer) { | ||
return buffer.join(''); | ||
}).join('/')); | ||
} | ||
@@ -110,6 +103,5 @@ /** | ||
function removeDotSegmentsOfPath(iri, colonPosition) { | ||
export function removeDotSegmentsOfPath(iri, colonPosition) { | ||
// Determine where we should start looking for the first '/' that indicates the start of the path | ||
let searchOffset = colonPosition + 1; | ||
var searchOffset = colonPosition + 1; | ||
@@ -125,3 +117,3 @@ if (colonPosition >= 0) { | ||
const pathSeparator = iri.indexOf('/', searchOffset); | ||
var pathSeparator = iri.indexOf('/', searchOffset); | ||
@@ -132,4 +124,4 @@ if (pathSeparator < 0) { | ||
const base = iri.substr(0, pathSeparator); | ||
const path = iri.substr(pathSeparator); // Remove dot segments from the path | ||
var base = iri.substr(0, pathSeparator); | ||
var path = iri.substr(pathSeparator); // Remove dot segments from the path | ||
@@ -147,6 +139,5 @@ return base + removeDotSegments(path); | ||
function resolve(relativeIRI, baseIRI) { | ||
export function resolve(relativeIRI, baseIRI) { | ||
baseIRI = baseIRI || ''; | ||
const baseFragmentPos = baseIRI.indexOf('#'); // Ignore any fragments in the base IRI | ||
var baseFragmentPos = baseIRI.indexOf('#'); // Ignore any fragments in the base IRI | ||
@@ -164,3 +155,3 @@ if (baseFragmentPos > 0) { | ||
if (relativeIRI.indexOf('?') === 0) { | ||
const baseQueryPos = baseIRI.indexOf('?'); | ||
var baseQueryPos = baseIRI.indexOf('?'); | ||
@@ -185,3 +176,3 @@ if (baseQueryPos > 0) { | ||
const valueColonPos = relativeIRI.indexOf(':'); | ||
var valueColonPos = relativeIRI.indexOf(':'); | ||
@@ -193,9 +184,9 @@ if (valueColonPos >= 0) { | ||
const baseColonPos = baseIRI.indexOf(':'); | ||
var baseColonPos = baseIRI.indexOf(':'); | ||
if (baseColonPos < 0) { | ||
throw new Error(`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'`); | ||
throw new Error("Found invalid baseIRI '".concat(baseIRI, "' for value '").concat(relativeIRI, "'")); | ||
} | ||
const baseIRIScheme = baseIRI.substr(0, baseColonPos + 1); // Inherit the baseIRI scheme if the value starts with '//' | ||
var baseIRIScheme = baseIRI.substr(0, baseColonPos + 1); // Inherit the baseIRI scheme if the value starts with '//' | ||
@@ -207,3 +198,3 @@ if (relativeIRI.indexOf('//') === 0) { | ||
let baseSlashAfterColonPos; | ||
var baseSlashAfterColonPos; | ||
@@ -218,3 +209,3 @@ if (baseIRI.indexOf('//', baseColonPos) === baseColonPos + 1) { | ||
if (baseIRI.length > baseColonPos + 3) { | ||
return `${baseIRI}/${removeDotSegmentsOfPath(relativeIRI, valueColonPos)}`; | ||
return "".concat(baseIRI, "/").concat(removeDotSegmentsOfPath(relativeIRI, valueColonPos)); | ||
} | ||
@@ -231,3 +222,3 @@ | ||
if (baseIRI.length > baseColonPos + 1) { | ||
return `${baseIRI}/${removeDotSegmentsOfPath(relativeIRI, valueColonPos)}`; | ||
return "".concat(baseIRI, "/").concat(removeDotSegmentsOfPath(relativeIRI, valueColonPos)); | ||
} | ||
@@ -243,4 +234,4 @@ | ||
let baseIRIPath = baseIRI.substr(baseSlashAfterColonPos); | ||
const baseIRILastSlashPos = baseIRIPath.lastIndexOf('/'); // Ignore everything after the last '/' in the baseIRI path | ||
var baseIRIPath = baseIRI.substr(baseSlashAfterColonPos); | ||
var baseIRILastSlashPos = baseIRIPath.lastIndexOf('/'); // Ignore everything after the last '/' in the baseIRI path | ||
@@ -247,0 +238,0 @@ if (baseIRILastSlashPos >= 0 && baseIRILastSlashPos < baseIRIPath.length - 1) { |
@@ -1,25 +0,10 @@ | ||
"use strict"; | ||
import isAbsoluteUrl from './is-absolute-url'; | ||
import { resolve } from './relative-to-absolute'; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var resolveUrl = function resolveUrl(_ref) { | ||
var _ref$relative = _ref.relative, | ||
relative = _ref$relative === void 0 ? '' : _ref$relative, | ||
base = _ref.base; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "isAbsoluteUrl", { | ||
enumerable: true, | ||
get: function () { | ||
return _isAbsoluteUrl.default; | ||
} | ||
}); | ||
exports.default = void 0; | ||
var _isAbsoluteUrl = _interopRequireDefault(require("./is-absolute-url")); | ||
var _relativeToAbsolute = require("./relative-to-absolute"); | ||
const resolveUrl = ({ | ||
relative = '', | ||
base: base | ||
}) => { | ||
if ((0, _isAbsoluteUrl.default)(relative)) { | ||
if (isAbsoluteUrl(relative)) { | ||
return relative; | ||
@@ -29,10 +14,10 @@ } | ||
if (!base) { | ||
const origin = window.location.origin; | ||
base = `${origin}/`; | ||
var origin = window.location.origin; | ||
base = "".concat(origin, "/"); | ||
} | ||
return (0, _relativeToAbsolute.resolve)(relative, base); | ||
return resolve(relative, base); | ||
}; | ||
var _default = resolveUrl; | ||
exports.default = _default; | ||
export { isAbsoluteUrl }; | ||
export default resolveUrl; |
{ | ||
"name": "@availity/resolve-url", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Resolve absolute url from relative urls", | ||
@@ -17,3 +17,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "4a3f6381d7ccbbbec777c015e2f53aa3c32778a1" | ||
"gitHead": "b46de8877b34a3215ce6a3775440403512f26e44" | ||
} |
import resolveUrl from './resolve-url'; | ||
import isAbsoluteUrl from './is-absolute-url'; | ||
import relativeToAbsolute from './relative-to-absolute'; | ||
import { resolve as relativeToAbsolute } from './relative-to-absolute'; | ||
@@ -5,0 +5,0 @@ export default resolveUrl; |
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
45130
964
1