Skip to content

Commit 6ef2ffe

Browse files
authored
cosmetic: extract updateRow logic
This should not have any performance impact. I just think it is bad practice to have multiline anonymous functions.
1 parent 7dfee8c commit 6ef2ffe

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

elm-v0.18.0/src/Main.elm

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,7 @@ update msg model =
259259
)
260260

261261
UpdateEvery amount ->
262-
( { model
263-
| rows =
264-
List.indexedMap
265-
(\index row ->
266-
if (index % 10) == 0 then
267-
{ row | label = row.label ++ " !!!" }
268-
else
269-
row
270-
)
271-
model.rows
272-
}
273-
, Cmd.none
274-
)
262+
( { model | rows = List.indexedMap updateRow model.rows }, Cmd.none )
275263

276264
Clear ->
277265
( { model | rows = [] }, Cmd.none )
@@ -317,6 +305,14 @@ update msg model =
317305
( { model | seed = Just seed }, Cmd.none )
318306

319307

308+
updateRow : Int -> Row -> Row
309+
updateRow index row =
310+
if index % 10 == 0 then
311+
{ row | label = row.label ++ " !!!" }
312+
else
313+
row
314+
315+
320316
select : Int -> Int -> Row -> Row
321317
select targetIndex index ({ id, label, selected } as row) =
322318
if index == targetIndex then

0 commit comments

Comments
 (0)