Skip to content

Commit

Permalink
fix: use getters instead
Browse files Browse the repository at this point in the history
  • Loading branch information
asyarb committed May 2, 2024
1 parent 104a0e1 commit 08a987e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@
"description": "Small wrapper around the native `URL` class that works with relative URLs.",
"license": "MIT",
"sideEffects": false,
"keywords": [
"url",
"relative"
],
"keywords": ["url", "relative"],
"author": {
"name": "Anthony Yarbrough",
"email": "asyarb@hawaii.edu"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "bunchee",
"dev": "vitest dev",
Expand Down
24 changes: 19 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,25 @@ export class RURL extends URL {
super(url, RURL.#FAKE_URL)
}

host = ""
hostname = ""
protocol = ""
origin = ""
href = super.href.replace(RURL.#FAKE_URL, "")
get host() {
return ""
}

get hostname() {
return ""
}

get protocol() {
return ""
}

get origin() {
return ""
}

get href() {
return super.href.replace(RURL.#FAKE_URL, "")
}

toString(): string {
return super.toString().replace(RURL.#FAKE_URL, "")
Expand Down

0 comments on commit 08a987e

Please sign in to comment.