Skip to content

Commit

Permalink
fix: Do not use getters and setters on public data object
Browse files Browse the repository at this point in the history
  • Loading branch information
Trygve Lie committed Mar 23, 2021
1 parent b37e787 commit 0505dcb
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions src/asset.js
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;
}
}

0 comments on commit 0505dcb

Please sign in to comment.