Fix type errors in LazySet.

I think the only place that was broken is where
we copy users from streams.
This commit is contained in:
Steve Howell
2020-01-14 22:29:54 +00:00
committed by Tim Abbott
parent b65138c83f
commit 29e63c0417
4 changed files with 41 additions and 4 deletions

View File

@@ -53,18 +53,30 @@ exports.LazySet = function (vals) {
self.has = function (v) {
make_set();
return self.set.has(v);
const val = self._clean(v);
return self.set.has(val);
};
self.add = function (v) {
make_set();
self.set.add(v);
const val = self._clean(v);
self.set.add(val);
};
self.del = function (v) {
make_set();
self.set.delete(v);
const val = self._clean(v);
self.set.delete(val);
};
self._clean = function (v) {
if (typeof v !== 'number') {
blueslip.error('not a number');
return parseInt(v, 10);
}
return v;
};
return self;
};