0.0.20 • Published 1 year ago

@vzx/utils v0.0.20

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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 year ago

0.0.19

1 year ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.5

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.1-1

2 years ago

0.0.1-0.1

2 years ago