UNPKG
wda
Version:
latest (1.0.0)
1.0.0
Facebook WebDriverAgent Client
github.com/zzyss86/wda
zzyss86/wda
wda
/
lib
/
utils.js
13 lines
•
365 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = { formatStr: function(tpl,
data
){
if
(tpl && /\${[a-zA-Z_]+}/.test(tpl) &&
data
){
return
tpl.replace(/\${([a-zA-Z_]+)}/gi,function(s1,s2){
if
(s2 &&
data
.hasOwnProperty(s2)){
return
data
[s2]; }
return
''
; }); }
return
tpl; } };