Apply consistent-return lint rule

This commit is contained in:
Zaid Abdulla committed 2018-08-25 03:22:48 -07:00
1 parent d7f0b91bf0
commit d85afcd2b5
12 files changed
+264 -231

No files matched your search

+6 -3
View File
@@ -19,6 +19,7 @@
"use strict";
const NONEXISTENT = new Object();
const UNDEFINED = undefined;
function compareEquality(a, b) {
var t = typeof a;
@@ -61,14 +62,16 @@ class VersionedMap {
if (rev == null) rev = this._revision;
var v = this.map.get(key);
if (!v) return;
if (!v) return UNDEFINED;
for (let i = Math.min(v.length - 1, rev); i >= 0; --i) {
if (i in v) {
if (v[i] === NONEXISTENT) return undefined;
if (v[i] === NONEXISTENT) return UNDEFINED;
else return v[i];
}
}
return UNDEFINED;
}
has(key, rev) {
@@ -99,7 +102,7 @@ class VersionedMap {
v = [];
v[rev] = value;
this.map.set(key, v);
return this;
return;
}
var old = v[Math.min(rev, v.length - 1)];