Extract function

This commit is contained in:
Jeroen Engels 2023-06-02 16:15:27 +02:00
parent 9ec3b770ae
commit 6a77dc3831

View File

@ -1171,17 +1171,17 @@ compactArbitraryFilesVisitor : Maybe ( List { a | path : String } -> moduleConte
compactArbitraryFilesVisitor maybeArbitraryFilesVisitor =
case maybeArbitraryFilesVisitor of
Just ( arbitraryFilesVisitor, requestedFiles ) ->
let
predicate : { a | path : String } -> Bool
predicate file =
List.member file.path requestedFiles
in
Just (\files moduleContext -> ( [], arbitraryFilesVisitor (List.filter predicate files) moduleContext ))
Just (\files moduleContext -> ( [], arbitraryFilesVisitor (List.filter (globMatch requestedFiles) files) moduleContext ))
Nothing ->
Nothing
globMatch : List String -> { a | path : String } -> Bool
globMatch requestedFiles file =
List.member file.path requestedFiles
-- PROJECT RULES