Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lazy_set: Return set from the _make_set method.

Priyank Pateld0c339e77266
diff --git a/static/js/lazy_set.js b/static/js/lazy_set.js
index df39ce916e8..7b10ac9d5a8 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) {