File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { isString } from "./is.ts" ;
2
2
3
+ /** インデント数を数える */
3
4
export const getIndentCount = ( text : string ) : number =>
4
5
text . match ( / ^ ( \s * ) / ) ?. [ 1 ] ?. length ?? 0 ;
5
6
@@ -8,10 +9,10 @@ export const getIndentCount = (text: string): number =>
8
9
* @param index 指定したい行の行番号
9
10
* @param lines 行のリスト
10
11
*/
11
- export function getIndentLineCount (
12
+ export const getIndentLineCount = (
12
13
index : number ,
13
14
lines : readonly string [ ] | readonly { text : string } [ ] ,
14
- ) : number {
15
+ ) : number => {
15
16
const base = getIndentCount ( getText ( index , lines ) ) ;
16
17
let count = 0 ;
17
18
while (
@@ -21,12 +22,12 @@ export function getIndentLineCount(
21
22
count ++ ;
22
23
}
23
24
return count ;
24
- }
25
+ } ;
25
26
26
- function getText (
27
+ const getText = (
27
28
index : number ,
28
29
lines : readonly string [ ] | readonly { text : string } [ ] ,
29
- ) {
30
+ ) => {
30
31
const line = lines [ index ] ;
31
32
return isString ( line ) ? line : line . text ;
32
- }
33
+ } ;
You can’t perform that action at this time.
0 commit comments