Skip to content

Commit 9517afd

Browse files
rain84idoocs
authored andcommitted
style: format code and docs with prettier
1 parent dd1159c commit 9517afd

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
function compressedString(word) {
2-
let res = '';
3-
4-
for (let i = 1, j = 0; i <= word.length; i++) {
5-
if (word[i] !== word[j] || i - j === 9) {
6-
res += i - j + word[j];
7-
j = i;
8-
}
9-
}
10-
11-
return res;
12-
}
1+
function compressedString(word) {
2+
let res = '';
3+
4+
for (let i = 1, j = 0; i <= word.length; i++) {
5+
if (word[i] !== word[j] || i - j === 9) {
6+
res += i - j + word[j];
7+
j = i;
8+
}
9+
}
10+
11+
return res;
12+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
function compressedString(word: string): string {
2-
let res = '';
3-
4-
for (let i = 1, j = 0; i <= word.length; i++) {
5-
if (word[i] !== word[j] || i - j === 9) {
6-
res += i - j + word[j];
7-
j = i;
8-
}
9-
}
10-
11-
return res;
12-
}
1+
function compressedString(word: string): string {
2+
let res = '';
3+
4+
for (let i = 1, j = 0; i <= word.length; i++) {
5+
if (word[i] !== word[j] || i - j === 9) {
6+
res += i - j + word[j];
7+
j = i;
8+
}
9+
}
10+
11+
return res;
12+
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
function compressedString(word) {
2-
const regex = /(.)\1{0,8}/g;
3-
let m = null;
4-
let res = '';
5-
6-
while ((m = regex.exec(word))) {
7-
res += m[0].length + m[1];
8-
}
9-
10-
return res;
11-
}
1+
function compressedString(word) {
2+
const regex = /(.)\1{0,8}/g;
3+
let m = null;
4+
let res = '';
5+
6+
while ((m = regex.exec(word))) {
7+
res += m[0].length + m[1];
8+
}
9+
10+
return res;
11+
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
function compressedString(word: string): string {
2-
const regex = /(.)\1{0,8}/g;
3-
let m: RegExpMatchArray | null = null;
4-
let res = '';
5-
6-
while ((m = regex.exec(word))) {
7-
res += m[0].length + m[1];
8-
}
9-
10-
return res;
11-
}
1+
function compressedString(word: string): string {
2+
const regex = /(.)\1{0,8}/g;
3+
let m: RegExpMatchArray | null = null;
4+
let res = '';
5+
6+
while ((m = regex.exec(word))) {
7+
res += m[0].length + m[1];
8+
}
9+
10+
return res;
11+
}

0 commit comments

Comments
 (0)