File tree Expand file tree Collapse file tree 1 file changed +1
-17
lines changed
extra/src/main/scala/japgolly/scalajs/react/extra/router Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -17,22 +17,6 @@ import scala.util.matching.Regex
1717 */
1818object StaticDsl {
1919
20- private val regexEscape1 = """ ([-()\[\]{}+?*.$\^|,:#<!\\ ])""" .r
21- private val regexEscape2 = """ \x08""" .r
22-
23- // TODO: Replace with Pattern.quote after Scala.JS 1.6.x
24- /**
25- * Pattern.quote doesn't work in Scala.JS.
26- *
27- * http://stackoverflow.com/questions/2593637/how-to-escape-regular-expression-in-javascript
28- */
29- def regexEscape (s : String ): String = {
30- var r = s
31- r = regexEscape1.replaceAllIn(r, """ \\ $1""" )
32- r = regexEscape2.replaceAllIn(r, """ \\ x08""" )
33- r
34- }
35-
3620 /**
3721 * Route builder. Allows you to specify routes like `"user" / int / "display"`.
3822 * Once complete, [[RouteB ]] will become a [[Route ]].
@@ -98,7 +82,7 @@ object StaticDsl {
9882 private val someUnit = Some (())
9983
10084 def literal (s : String ): RouteB [Unit ] =
101- new RouteB (regexEscape (s), 0 , _ => someUnit, _ => s)
85+ new RouteB (Pattern .quote (s), 0 , _ => someUnit, _ => s)
10286
10387 val / = literal(" /" )
10488 }
You can’t perform that action at this time.
0 commit comments