Skip to content

Commit 5056cca

Browse files
committed
♻️
1 parent 6dc2924 commit 5056cca

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

text.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { isString } from "./is.ts";
22

3+
/** インデント数を数える */
34
export const getIndentCount = (text: string): number =>
45
text.match(/^(\s*)/)?.[1]?.length ?? 0;
56

@@ -8,10 +9,10 @@ export const getIndentCount = (text: string): number =>
89
* @param index 指定したい行の行番号
910
* @param lines 行のリスト
1011
*/
11-
export function getIndentLineCount(
12+
export const getIndentLineCount = (
1213
index: number,
1314
lines: readonly string[] | readonly { text: string }[],
14-
): number {
15+
): number => {
1516
const base = getIndentCount(getText(index, lines));
1617
let count = 0;
1718
while (
@@ -21,12 +22,12 @@ export function getIndentLineCount(
2122
count++;
2223
}
2324
return count;
24-
}
25+
};
2526

26-
function getText(
27+
const getText = (
2728
index: number,
2829
lines: readonly string[] | readonly { text: string }[],
29-
) {
30+
) => {
3031
const line = lines[index];
3132
return isString(line) ? line : line.text;
32-
}
33+
};

0 commit comments

Comments
 (0)