From 9ae814dfe45426f8df9b89b305392770344a7d50 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 17 Sep 2017 08:59:12 +0900 Subject: more strict lint --- src/console/completion.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/console/completion.js') 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; } } -- cgit v1.2.3