Skip to content

Commit daf712f

Browse files
committed
Fixed: Escape dash character
An unescaped dash can be misinterpreted in JavaScript, so it is escaped. This is a follow-on from elm-community/string-extra#47, but the method of fixing it is to explicitly escape the dash, rather than moving its position.
1 parent d66a384 commit daf712f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/String/Extra.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ underscored string =
337337
string
338338
|> String.trim
339339
|> Regex.replace (regexFromString "([a-z\\d])([A-Z]+)") (.submatches >> List.filterMap identity >> String.join "_")
340-
|> Regex.replace (regexFromString "[_-\\s]+") (always "_")
340+
|> Regex.replace (regexFromString "[_\\-\\s]+") (always "_")
341341
|> String.toLower
342342

343343

0 commit comments

Comments
 (0)