aboutsummaryrefslogtreecommitdiff
path: root/src/content/domains
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-05-02 17:25:56 +0900
committerGitHub <noreply@github.com>2020-05-02 17:25:56 +0900
commit5df0537bcf65a341e79852b1b30379c73318529c (patch)
treeaee5efe52412855f620cb514a13a2c14373f27b7 /src/content/domains
parent685f2b7b69218b06b5bb676069e35f79c5048c9b (diff)
parent75abd90ecb8201ad845b266f96220d8adfe19b2d (diff)
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/content/domains')
-rw-r--r--src/content/domains/KeySequence.ts29
-rw-r--r--src/content/domains/Mark.ts1
2 files changed, 14 insertions, 16 deletions
diff --git a/src/content/domains/KeySequence.ts b/src/content/domains/KeySequence.ts
index cf59125..5819fc5 100644
--- a/src/content/domains/KeySequence.ts
+++ b/src/content/domains/KeySequence.ts
@@ -1,10 +1,7 @@
-import Key from '../../shared/settings/Key';
+import Key from "../../shared/settings/Key";
export default class KeySequence {
- constructor(
- public readonly keys: Key[],
- ) {
- }
+ constructor(public readonly keys: Key[]) {}
push(key: Key): number {
return this.keys.push(key);
@@ -27,25 +24,26 @@ export default class KeySequence {
}
isDigitOnly(): boolean {
- return this.keys.every(key => key.isDigit());
+ return this.keys.every((key) => key.isDigit());
}
repeatCount(): number {
- let nonDigitAt = this.keys.findIndex(key => !key.isDigit());
+ let nonDigitAt = this.keys.findIndex((key) => !key.isDigit());
if (this.keys.length === 0 || nonDigitAt === 0) {
return 1;
}
if (nonDigitAt === -1) {
nonDigitAt = this.keys.length;
}
- const digits = this.keys.slice(0, nonDigitAt)
- .map(key => key.key)
- .join('');
+ const digits = this.keys
+ .slice(0, nonDigitAt)
+ .map((key) => key.key)
+ .join("");
return Number(digits);
}
trimNumericPrefix(): KeySequence {
- let nonDigitAt = this.keys.findIndex(key => !key.isDigit());
+ let nonDigitAt = this.keys.findIndex((key) => !key.isDigit());
if (nonDigitAt === -1) {
nonDigitAt = this.keys.length;
}
@@ -53,7 +51,7 @@ export default class KeySequence {
}
splitNumericPrefix(): [KeySequence, KeySequence] {
- const nonDigitIndex = this.keys.findIndex(key => !key.isDigit());
+ const nonDigitIndex = this.keys.findIndex((key) => !key.isDigit());
if (nonDigitIndex === -1) {
return [this, new KeySequence([])];
}
@@ -65,15 +63,16 @@ export default class KeySequence {
static fromMapKeys(keys: string): KeySequence {
const fromMapKeysRecursive = (
- remaining: string, mappedKeys: Key[],
+ remaining: string,
+ mappedKeys: Key[]
): Key[] => {
if (remaining.length === 0) {
return mappedKeys;
}
let nextPos = 1;
- if (remaining.startsWith('<')) {
- const ltPos = remaining.indexOf('>');
+ if (remaining.startsWith("<")) {
+ const ltPos = remaining.indexOf(">");
if (ltPos > 0) {
nextPos = ltPos + 1;
}
diff --git a/src/content/domains/Mark.ts b/src/content/domains/Mark.ts
index 0c40988..68ed226 100644
--- a/src/content/domains/Mark.ts
+++ b/src/content/domains/Mark.ts
@@ -2,4 +2,3 @@ export default interface Mark {
x: number;
y: number;
}
-