diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-17 08:59:12 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-17 08:59:12 +0900 |
commit | 9ae814dfe45426f8df9b89b305392770344a7d50 (patch) | |
tree | db082d9cb2ec426010556dbc24ab439c9757afbd /src/console/completion.js | |
parent | c5529958d53146c8c6826673abe6431a19f1924d (diff) |
more strict lint
Diffstat (limited to 'src/console/completion.js')
-rw-r--r-- | src/console/completion.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/console/completion.js b/src/console/completion.js index 0c21cb0..4c69afb 100644 --- a/src/console/completion.js +++ b/src/console/completion.js @@ -3,15 +3,16 @@ export default class Completion { if (typeof completions.length !== 'number') { throw new TypeError('completions does not have a length in number'); } - this.completions = completions + this.completions = completions; this.index = 0; } prev() { - if (this.completions.length === 0) { + let length = this.completions.length; + if (length === 0) { return null; } - this.index = (this.index + this.completions.length - 1) % this.completions.length + this.index = (this.index + length - 1) % length; return this.completions[this.index]; } @@ -20,7 +21,7 @@ export default class Completion { return null; } let item = this.completions[this.index]; - this.index = (this.index + 1) % this.completions.length + this.index = (this.index + 1) % this.completions.length; return item; } } |