mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
Remove not functions from Glob API for now.
This commit is contained in:
parent
ad732d428e
commit
664cb77c78
43
src/Glob.elm
43
src/Glob.elm
@ -1,11 +1,11 @@
|
||||
module Glob exposing
|
||||
( Glob, atLeastOne, extractMatches, fullFilePath, literal, map, not, notOneOf, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
|
||||
( Glob, atLeastOne, extractMatches, fullFilePath, literal, map, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
|
||||
, capture, ignore
|
||||
)
|
||||
|
||||
{-|
|
||||
|
||||
@docs Glob, atLeastOne, extractMatches, fullFilePath, literal, map, not, notOneOf, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
|
||||
@docs Glob, atLeastOne, extractMatches, fullFilePath, literal, map, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
|
||||
|
||||
@docs capture, ignore
|
||||
|
||||
@ -122,44 +122,6 @@ regexEscaped stringLiteral =
|
||||
stringLiteral
|
||||
|
||||
|
||||
{-| -}
|
||||
not : String -> Glob String
|
||||
not string =
|
||||
Glob ("!(" ++ string ++ ")")
|
||||
"TODO"
|
||||
(\_ captures ->
|
||||
case captures of
|
||||
first :: rest ->
|
||||
( first, rest )
|
||||
|
||||
[] ->
|
||||
( "ERROR", [] )
|
||||
)
|
||||
|
||||
|
||||
{-| -}
|
||||
notOneOf : ( String, List String ) -> Glob String
|
||||
notOneOf ( firstPattern, otherPatterns ) =
|
||||
let
|
||||
allPatterns =
|
||||
firstPattern :: otherPatterns
|
||||
in
|
||||
Glob
|
||||
("!("
|
||||
++ (allPatterns |> String.join "|")
|
||||
++ ")"
|
||||
)
|
||||
"TODO"
|
||||
(\_ captures ->
|
||||
case captures of
|
||||
first :: rest ->
|
||||
( first, rest )
|
||||
|
||||
[] ->
|
||||
( "ERROR", [] )
|
||||
)
|
||||
|
||||
|
||||
{-| -}
|
||||
run : String -> RawGlob -> Glob a -> { match : a, pattern : String }
|
||||
run rawInput { captures, fullPath } (Glob pattern regex applyCapture) =
|
||||
@ -171,7 +133,6 @@ run rawInput { captures, fullPath } (Glob pattern regex applyCapture) =
|
||||
regexCaptures =
|
||||
Regex.find parsedRegex rawInput
|
||||
|> List.concatMap .submatches
|
||||
|> List.filterMap identity
|
||||
|> List.map (Maybe.withDefault "")
|
||||
|
||||
parsedRegex =
|
||||
|
@ -124,38 +124,6 @@ all =
|
||||
, expectedMatch = ( "a/b/c", "d" )
|
||||
, expectedPattern = "**/*.txt"
|
||||
}
|
||||
, test "not" <|
|
||||
\() ->
|
||||
Glob.succeed Tuple.pair
|
||||
|> Glob.capture
|
||||
(Glob.notOneOf
|
||||
( "xyz", [] )
|
||||
)
|
||||
|> Glob.ignore (Glob.literal "/")
|
||||
|> Glob.capture Glob.wildcard
|
||||
|> Glob.ignore (Glob.literal ".txt")
|
||||
|> expect "abc/d.txt"
|
||||
-- abc/d.txt
|
||||
-- https://runkit.com/embed/05epbnc0c7g1
|
||||
{ captures = [ "abc", "d" ]
|
||||
, expectedMatch = ( "abc", "d" )
|
||||
, expectedPattern = "!(xyz)/*.txt"
|
||||
}
|
||||
, test "not with multiple patterns" <|
|
||||
\() ->
|
||||
Glob.succeed Tuple.pair
|
||||
|> Glob.capture
|
||||
(Glob.notOneOf ( "abz", [ "xyz" ] ))
|
||||
|> Glob.ignore (Glob.literal "/")
|
||||
|> Glob.capture Glob.wildcard
|
||||
|> Glob.ignore (Glob.literal ".txt")
|
||||
|> expect "abc/d.txt"
|
||||
-- abc/d.txt
|
||||
-- https://runkit.com/embed/05epbnc0c7g1
|
||||
{ captures = [ "abc", "d" ]
|
||||
, expectedMatch = ( "abc", "d" )
|
||||
, expectedPattern = "!(abz|xyz)/*.txt"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user