Skip to content

Commit

Permalink
Generator.Normalize: Use new Regex API
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian committed Aug 12, 2018
1 parent d74a5c6 commit e2b015b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Graphqelm/Generator/Normalize.elm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ normalizeIfElmReserved name =

underscores : String -> { leading : String, trailing : String, remaining : String }
underscores string =
case Regex.find Regex.All (Regex.regex "^(_*)([^_]?.*[^_]?)(_*)$") string |> List.head |> Maybe.map .submatches of
let
regexFromString =
Regex.fromString >> Maybe.withDefault Regex.never
in
case Regex.find (regexFromString "^(_*)([^_]?.*[^_]?)(_*)$") string |> List.head |> Maybe.map .submatches of
Just [ Just leading, Just remaining, Just trailing ] ->
{ leading = leading
, trailing = trailing
Expand Down

0 comments on commit e2b015b

Please sign in to comment.