安装
环境要求
- Node.js >= 22.0.0
- 现代浏览器(支持 ES2022)
包管理器安装
npm
bash
npm install @tofrankie/utilspnpm
bash
pnpm add @tofrankie/utilsyarn
bash
yarn add @tofrankie/utilsCDN 使用
ESM
html
<script type="module">
import { debounce, throttle } from 'https://unpkg.com/@tofrankie/utils@latest/dist/index.mjs'
</script>UMD
html
<script src="https://unpkg.com/@tofrankie/utils@latest/dist/index.cjs"></script>
<script>
const { debounce, throttle } = window.JavaScriptUtils
</script>验证安装
typescript
import { debounce, throttle } from '@tofrankie/utils'
console.log(typeof debounce) // 'function'
console.log(typeof throttle) // 'function'版本管理
查看版本
bash
npm list @tofrankie/utils更新版本
bash
npm update @tofrankie/utils指定版本
bash
npm install @tofrankie/utils@1.0.0