@stoplight/common
Advanced tools
Comparing version 0.0.11-4 to 0.0.11-7
@@ -72,2 +72,3 @@ import { ILocation, IUriComponents } from './types'; | ||
readonly fsPath: string; | ||
readonly origin: string; | ||
readonly location: ILocation; | ||
@@ -89,4 +90,5 @@ isAbsolute(): boolean; | ||
toString(skipEncoding?: boolean): string; | ||
toURL(): any; | ||
toJSON(): any; | ||
toJSONPointer(): string; | ||
} |
@@ -290,2 +290,8 @@ "use strict"; | ||
} | ||
get origin() { | ||
if (this.scheme && this.authority) { | ||
return `${this.scheme}://${this.authority}`; | ||
} | ||
return ''; | ||
} | ||
get location() { | ||
@@ -324,3 +330,3 @@ const res = { | ||
isAbsolute() { | ||
return this.scheme ? true : false; | ||
return this.scheme && this.authority ? true : false; | ||
} | ||
@@ -405,2 +411,21 @@ isFile() { | ||
} | ||
toURL() { | ||
let url = ''; | ||
if (this._scheme) { | ||
url += `${this._scheme}://`; | ||
} | ||
if (this._authority) { | ||
url += this._authority; | ||
} | ||
if (this._path) { | ||
url += this._path; | ||
} | ||
if (this._query) { | ||
url += `?${this._query}`; | ||
} | ||
if (this._fragment) { | ||
url += `#${this._fragment}`; | ||
} | ||
return url; | ||
} | ||
toJSON() { | ||
@@ -407,0 +432,0 @@ const res = { |
{ | ||
"name": "@stoplight/common", | ||
"version": "0.0.11-4", | ||
"version": "0.0.11-7", | ||
"description": "Stoplight common type and interface definitions.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
77604
1406