UNPKG
strings
Version:
latest (0.4.2)
0.4.2
0.4.1
0.4.0
0.3.3
0.3.1
0.3.0
0.2.1
0.2.0
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.2
Easily replace and transform :props in strings.
github.com/assemble/strings
assemble/strings
strings
/
docs
/
example-parser.md
24 lines
(22 loc)
•
294 B
Markdown
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Pass an
object
: ```js strings.
parser
(
'prop'
, {
pattern
: /:([\\w]+)/, replacement:
function
(
match
)
{
return
match
.
toUpperCase
(); } ); ``` Or an
array
```js strings.
parser
(
'prop'
, [ {
pattern
:
'a'
,
replacement
:
'b'
}, {
pattern
:
'c'
,
replacement
:
'd'
} ]); ```