0.0.20 • Published 1 month ago
@vzx/utils v0.0.20
debounce
防抖
const debounceFunc = debounce(function() {
// ...some code
}[, 300[, true]]);
debounceFunc();
throttle
节流
const throttleFunc = throttle(function() {
// ...some code
}[, 300[, true]]);
throttleFunc();
randomString
生成随机字符串
randomString(16);
resolvePath
把路径或路径片段的序列解析为绝对路径
resolvePath("/a", "./b", "../b/c", "d");
getUrlParams
获取 url 参数
getUrlParams("http://abc.com?id=1", "id");
listToTree
列表转树形结构
listToTree(
list,
(item) => {
return {
...item,
name: "v-" + item.name,
};
},
{
id: "idKey",
parentId: "parentIdKey",
children: "childrenKey",
leaf: "isLeaf",
rootId: null,
}
);
upperFirst
首字母大写
upperFirst("case");
camelize
字符串转驼峰命名
camelize("case");
pascalize
字符串转大驼峰命名
pascalize("case");
kebabize
字符串转中线命名
kebabize("case");
snakelize
字符串转下划线命名
snakelize("case");
0.0.20
1 month ago
0.0.19
4 months ago
0.0.12
8 months ago
0.0.13
8 months ago
0.0.14
8 months ago
0.0.15
6 months ago
0.0.16
6 months ago
0.0.17
6 months ago
0.0.18
6 months ago
0.0.11
11 months ago
0.0.10
11 months ago
0.0.9
11 months ago
0.0.8
11 months ago
0.0.7
12 months ago
0.0.6
12 months ago
0.0.4
12 months ago
0.0.5
12 months ago
0.0.3
12 months ago
0.0.2
1 year ago
0.0.1
1 year ago
0.0.1-1
1 year ago
0.0.1-0.1
1 year ago