diff options
| author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-02 17:25:56 +0900 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-02 17:25:56 +0900 | 
| commit | 5df0537bcf65a341e79852b1b30379c73318529c (patch) | |
| tree | aee5efe52412855f620cb514a13a2c14373f27b7 /src/shared/settings/Key.ts | |
| parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) | |
| parent | 75abd90ecb8201ad845b266f96220d8adfe19b2d (diff) | |
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/shared/settings/Key.ts')
| -rw-r--r-- | src/shared/settings/Key.ts | 20 | 
1 files changed, 11 insertions, 9 deletions
| diff --git a/src/shared/settings/Key.ts b/src/shared/settings/Key.ts index 1464e57..2f47aff 100644 --- a/src/shared/settings/Key.ts +++ b/src/shared/settings/Key.ts @@ -1,4 +1,4 @@ -const digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; +const digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];  export default class Key {    public readonly key: string; @@ -32,10 +32,10 @@ export default class Key {    }    static fromMapKey(str: string): Key { -    if (str.startsWith('<') && str.endsWith('>')) { +    if (str.startsWith("<") && str.endsWith(">")) {        const inner = str.slice(1, -1); -      const shift = inner.includes('S-'); -      let base = inner.slice(inner.lastIndexOf('-') + 1); +      const shift = inner.includes("S-"); +      let base = inner.slice(inner.lastIndexOf("-") + 1);        if (shift && base.length === 1) {          base = base.toUpperCase();        } else if (!shift && base.length === 1) { @@ -44,9 +44,9 @@ export default class Key {        return new Key({          key: base,          shift: shift, -        ctrl: inner.includes('C-'), -        alt: inner.includes('A-'), -        meta: inner.includes('M-'), +        ctrl: inner.includes("C-"), +        alt: inner.includes("A-"), +        meta: inner.includes("M-"),        });      } @@ -64,10 +64,12 @@ export default class Key {    }    equals(key: Key) { -    return this.key === key.key && +    return ( +      this.key === key.key &&        this.ctrl === key.ctrl &&        this.meta === key.meta &&        this.alt === key.alt && -      this.shift === key.shift; +      this.shift === key.shift +    );    }  } | 
