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
/
trimLeft.js
14 lines
(11 loc)
•
306 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
var
toValueString =
require
(
'./toValueString'
)
/** * 去除字符串左边的空格 * *
@param
{
String
} str 字符串 *
@return
{
String
} */
function
trimLeft
(
str
) {
return
str && str.
trimLeft
? str.
trimLeft
() :
toValueString
(str).
replace
(
/^[\s\uFEFF\xA0]+/g
,
''
) }
module
.
exports
= trimLeft