File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 100
100
--- @return integer CMode
101
101
function O .linewise (p )
102
102
local lcs_esc , rcs_esc = U .escape (p .lcs ), U .escape (p .rcs )
103
- local pattern = U .get_pattern (p .cfg .ignore )
103
+ local pattern = U .is_fn (p .cfg .ignore )
104
104
local padding , pp = U .get_padding (p .cfg .padding )
105
105
local is_commented = U .is_commented (lcs_esc , rcs_esc , pp )
106
106
Original file line number Diff line number Diff line change @@ -93,17 +93,13 @@ function U.escape(str)
93
93
end
94
94
95
95
--- Call a function if exists
96
- --- @param fn function Hook function
96
+ --- @param fn function Wanna be function
97
97
--- @return boolean | string
98
98
function U .is_fn (fn , ...)
99
- return type (fn ) == ' function' and fn (... )
100
- end
101
-
102
- --- Helper to compute the ignore pattern
103
- --- @param ig string | function
104
- --- @return boolean | string
105
- function U .get_pattern (ig )
106
- return ig and (type (ig ) == ' string' and ig or U .is_fn (ig ))
99
+ if type (fn ) == ' function' then
100
+ return fn (... )
101
+ end
102
+ return fn
107
103
end
108
104
109
105
--- Check if the given line is ignored or not with the given pattern
You can’t perform that action at this time.
0 commit comments