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 11import { isString } from "./is.ts" ;
22
3+ /** インデント数を数える */
34export 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+ } ;
You can’t perform that action at this time.
0 commit comments