1.9.1 • Published 5 days ago

ut2 v1.9.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 days ago

ut2

一个现代 JavaScript 实用工具库。点击查看在线文档

npm Build and Deploy Docs codecov Static Badge npm GitHub

比较

与其他工具库对比(lodashunderscore

  • 大部分是基于 ES2015+ 标准实现的纯函数,没有过多的包装嵌套。
  • 使用 TypeScript 实现,提供类型定义。
  • 导出 escjsumd 模块格式,支持不同开发环境使用。

兼容性

兼容现代浏览器 FirefoxChromeSafariOpera,以及 Node.js >= 10

如果要兼容 IE 系列浏览器,需要提供相应的 Polyfill 支持,建议使用 @babel/preset-env 设置对应的 targets

使用

esnode 开发环境

安装依赖

npm install ut2
yarn add ut2
pnpm add ut2

浏览器原生开发环境

如果你的项目使用的是原生方式开发,可以在浏览器中使用 script 标签直接引入文件,并使用全局变量 ut2

npm 包的 ut2/dist 目录下提供了 UMDut2.js 以及 ut2.min.js。你也可以通过 UNPKG 下载到本地进行使用。或者直接使用 UNPKG 线上版本 注意版本

示例

所有方法都在 ut2 模块中。

import { debounce } from 'ut2';

const debounced = debounce(() => {
  // do something
}, 300);

API

下列方法全部在 ut2 模块直接导出,分类只是为了可读性。你可以点击查看在线文档,了解更多信息。

import { throttle, chunk, max } from 'ut2'

1.9.1

5 days ago

1.9.0

7 days ago

1.8.1

10 days ago

1.8.0

12 days ago

1.7.2

1 month ago

1.7.1

3 months ago

1.7.0

4 months ago

1.6.0

4 months ago

1.5.5

7 months ago

1.5.4

7 months ago

1.5.3

7 months ago

1.5.6

5 months ago

1.2.0

10 months ago

1.1.1

11 months ago

1.0.2

11 months ago

1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

1.4.6

9 months ago

1.4.5

9 months ago

1.4.4

9 months ago

1.5.2

7 months ago

1.4.3

10 months ago

1.5.1

7 months ago

1.4.2

10 months ago

1.5.0

7 months ago

1.4.1

10 months ago

1.3.2

10 months ago

1.0.5

11 months ago

1.4.0

10 months ago

1.3.1

10 months ago

1.2.2

10 months ago

1.1.3

11 months ago

1.0.4

11 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.1.2

11 months ago

1.0.3

11 months ago

1.4.9

8 months ago

1.4.8

9 months ago

1.4.10

7 months ago

1.4.7

9 months ago

0.0.0

3 years ago