目标数
小数点后保留位数
是否展示千分位符号 ,
deepClone({a: 1, b: 2}) => {a: 1, b: 2}
formatDate(1613268688559, "yyyy/MM/dd") => "2021/02/14"
trim(" abc ") => "abc"
trim(" a b c ") => "a b c"
trim("") => ""
getAllQueries("http://www.aaa.com/path?q1=11&q2=22&q3=33")
=>
{
q1: "11",
q2: "22",
q3: "33"
}
返回 url传参组成的对象
getQuery("q1", "http://www.aaa.com/path?q1=11&q2=22&q3=33") => "11"
getQuery("q4", "http://www.aaa.com/path") => null
// 如在请求传参之前,去除空的值,不包含0
const params = {
a: 0,
b: null,
c: 1,
d: ""
}
noFakeParams(params) => { a: 0, c: 1 }
const params = {
q1: "abc",
q2: "hello",
q4: "444"
}
replaceQuery("http://www.aaa.com/path?q1=11&q2=22&q3=33", params)
=>
"http://www.aaa.com/path?q1=abc&q2=hello&q3=33&q4=444"
const params = {
a: 0,
b: null,
c: 1,
d: ""
}
serialQuery(params) => "a=0&c=1"
isArray([]) => true
isArray({}) => false
isDate(new Date()) => true
isDate({}) => false
isEmpty({}) => true
isEmpty([]) => true
isEmpty("") => true
isEmpty(null) => true
isEmpty(undefined) => true
isEmpty(0) => false
isFunction(()=>{}) => true
isNull(null) => true
isObject({}) => true
isRegExp(new RegExp(/1/g)) => true
whatsType({}, "Object") => true
whatsType([], "Array") => true
whatsType(new Date(), "Date") => true
whatsType(() => {}, "Function")) => true
whatsType(null, "Null") => true
whatsType(new RegExp(/1/g), "RegExp")) => true
返回布尔值
flatArray([[1], [2]]) => [1, 2]
flatArray([[1], [2, 3, [4, 5]]], 2) => [1, 2, 3, [4, 5]]
目标数组
扁平的层级
hello("xpots") => "Hello xpots"
姓名
返回 "hello ${name}"
Generated using TypeDoc
fixed(10000, 3, true) => "10,000.000" fixed(233.68, 5) => "233.68000" fixed(123.45, -2) => "123"
v0.1.0
v0.1.0
这个方法用于小数后位数补全, 也支持展示千分位符,最后返回一个字符串
林文书