Skip to content

Commit ec79ffd

Browse files
committed
Fix: functionをarrow functionにする
- `getCodeBlocks.ts`のみ
1 parent 24006a9 commit ec79ffd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

rest/getCodeBlocks.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,40 +94,40 @@ export const getCodeBlocks = async (
9494
};
9595

9696
/** targetを`Line[]`に変換する */
97-
async function getLines(
97+
const getLines = async (
9898
target: { project: string; title: string; lines?: Line[] },
99-
): Promise<Line[]> {
99+
): Promise<Line[]> => {
100100
if (target.lines !== undefined) {
101101
return target.lines;
102102
} else {
103103
const head = await pull(target.project, target.title);
104104
return head.lines;
105105
}
106-
}
106+
};
107107

108108
/** コードブロックのフィルターに合致しているか検証する */
109-
function isMatchFilter(
109+
const isMatchFilter = (
110110
codeBlock: TinyCodeBlock,
111111
filter?: GetCodeBlocksFilter,
112-
): boolean {
112+
): boolean => {
113113
const equals = (a: unknown, b: unknown) => !a || a === b;
114114
return (
115115
equals(filter?.filename, codeBlock.filename) &&
116116
equals(filter?.lang, codeBlock.lang) &&
117117
equals(filter?.titleLineId, codeBlock.titleLine.id)
118118
);
119-
}
119+
};
120120

121121
/** 行テキストがコードブロックの一部であればそのテキストを、そうでなければnullを返す
122122
*
123123
* @param lineText {string} 行テキスト
124124
* @param titleIndent {number} コードブロックのタイトル行のインデントの深さ
125125
* @return `lineText`がコードブロックの一部であればそのテキストを、そうでなければ`null`を返す
126126
*/
127-
function extractFromCodeBody(
127+
const extractFromCodeBody = (
128128
lineText: string,
129129
titleIndent: number,
130-
): string | null {
130+
): string | null => {
131131
const matched = lineText.replaceAll("\r", "").match(/^(\s*)(.*)$/);
132132
if (matched === null || matched.length < 2) {
133133
return null;
@@ -136,4 +136,4 @@ function extractFromCodeBody(
136136
const body = matched[2];
137137
if (indent.length <= titleIndent) return null;
138138
return indent.slice(indent.length - titleIndent) + body;
139-
}
139+
};

0 commit comments

Comments
 (0)