From d0c339e772664bd76bd24158b7ec0446bc19690e Mon Sep 17 00:00:00 2001 From: Priyank Patel Date: Sun, 9 Jan 2022 06:59:08 +0000 Subject: [PATCH] lazy_set: Return set from the _make_set method. This is done to avoid adding typescript type error checks when this is converted to typescript. --- static/js/lazy_set.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/static/js/lazy_set.js b/static/js/lazy_set.js index df39ce916e..7b10ac9d5a 100644 --- a/static/js/lazy_set.js +++ b/static/js/lazy_set.js @@ -49,13 +49,15 @@ export class LazySet { _make_set() { if (this.data.set !== undefined) { - return; + return this.data.set; } this.data = { arr: undefined, set: new Set(this.data.arr), }; + + return this.data.set; } map(f) { @@ -69,15 +71,15 @@ export class LazySet { } add(v) { - this._make_set(); + const set = this._make_set(); const val = this._clean(v); - this.data.set.add(val); + set.add(val); } delete(v) { - this._make_set(); + const set = this._make_set(); const val = this._clean(v); - return this.data.set.delete(val); + return set.delete(val); } _clean(v) {