UNPKG
di-shan-utils
Version:
latest (1.0.5)
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
JavaScript 函数库、工具类
di-shan-utils
/
dist
/
toFormatString.js
13 lines
(10 loc)
•
270 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
var
template =
require
(
'./template'
)
/** * 字符串格式化占位符 *
@param
{
string
} str *
@param
{
object | any[]
} obj */
function
toFormatString
(
str, obj
) {
return
template
(str, obj,{
tmplRE
:
/\{([.\w[\]\s]+)\}/g
}) }
module
.
exports
= toFormatString