UNPKG
@riotjs/parser
Version:
latest (10.0.0)
10.0.0
9.1.1
9.1.0
9.0.1
9.0.0
5.0.1
5.0.0
4.3.1
4.3.0
4.2.1
4.2.0
4.1.2
4.1.1
4.1.0
4.0.3
4.0.2
4.0.1
4.0.0
4.0.0-rc.2
4.0.0-rc.1
0.8.1
0.8.0
0.7.0
The parser for Riot tags
github.com/riot/parser
riot/parser
@riotjs/parser
/
src
/
utils
/
escape-str.js
7 lines
(6 loc)
•
234 B
JavaScript
View Raw
1
2
3
4
5
6
7
/** * Escape special characters in a given string, in preparation to create a regex. *
@param
{
string
}
str
- Raw string *
@returns
{
string
} Escaped string. */
export
default
(str) => str.
replace
(
/(?=[-[\](){^*+?.$|\\])/g
,
'\\'
)