-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Do not use getters and setters on public data object
- Loading branch information
Trygve Lie
committed
Mar 23, 2021
1 parent
b37e787
commit 0505dcb
Showing
1 changed file
with
2 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,8 @@ | ||
const inspect = Symbol.for('nodejs.util.inspect.custom'); | ||
|
||
export default class Asset { | ||
#integrity; | ||
#value; | ||
|
||
constructor({ | ||
value = '', | ||
} = {}) { | ||
this.#integrity = null; | ||
this.#value = value; | ||
} | ||
|
||
get integrity() { | ||
return this.#integrity; | ||
} | ||
|
||
set integrity(value) { | ||
this.#integrity = value; | ||
} | ||
|
||
get value() { | ||
return this.#value; | ||
} | ||
|
||
set value(value) { | ||
this.#value = value; | ||
} | ||
|
||
toJSON() { | ||
return { | ||
integrity: this.#integrity, | ||
value: this.#value, | ||
} | ||
} | ||
|
||
[inspect]() { | ||
return this.toJSON(); | ||
this.integrity = null; | ||
this.value = value; | ||
} | ||
} |