more strict lint

This commit is contained in:
Shin'ya Ueoka 2017-09-17 08:59:12 +09:00
parent c5529958d5
commit 9ae814dfe4
21 changed files with 211 additions and 157 deletions

View file

@ -11,19 +11,19 @@ export default class HintKeyProducer {
produce() {
this.increment();
return this.counter.map((x) => this.charset[x]).join('');
return this.counter.map(x => this.charset[x]).join('');
}
increment() {
let max = this.charset.length - 1;
if (this.counter.every((x) => x == max)) {
if (this.counter.every(x => x === max)) {
this.counter = new Array(this.counter.length + 1).fill(0);
return;
}
this.counter.reverse();
let len = this.charset.length;
let num = this.counter.reduce((x,y,index) => x + y * (len ** index)) + 1;
let num = this.counter.reduce((x, y, index) => x + y * len ** index) + 1;
for (let i = 0; i < this.counter.length; ++i) {
this.counter[i] = num % len;
num = ~~(num / len);