fjc0k / Vtils
Licence: mit
一个面向业务的 JavaScript/TypeScript 实用程序库。支持在浏览器、Node.js、小程序、Taro、Deno 下使用。
Stars: ✭ 177
Programming Languages
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Projects that are alternatives of or similar to Vtils
Ppo
ppo is a super small and useful utils library for JavaScript 🐝🐜
Stars: ✭ 105 (-40.68%)
Mutual labels: utils
Myutils
🙏 提供时间轴转星座|生肖工具、系统存储空间获取工具、文件大小格式化工具、获取指定文件大小工具、AES加密解码工具(支持android端平台加密解密,java端和android端相互加密解密)、SharePreference操作工具、 File文件操作工具、日期获取和计算工具、界面跳转Intent操作工具、字符串验证和数值转换操作工具、手机震动工具、系统资源操作工具、网络检测工具、 wifi操作工具、单位换算工具、zip压缩和解压操作工具、XML解析操作工具(只支持几种指定格式)、图片加载和处理工具,数据库操作(增删改查)工具、Base64编码解码工具、MD5加密工具。
Stars: ✭ 130 (-26.55%)
Mutual labels: utils
Pine Utils
Code Snippets + Tricks & Tips to help Pine Script developers
Stars: ✭ 149 (-15.82%)
Mutual labels: utils
Ramda Extension
🤘Utility library for functional JavaScript. With ❤️ to Ramda.
Stars: ✭ 139 (-21.47%)
Mutual labels: utils
Utils.js
Useful JavaScript Functions Collection 一些很实用的JavaScript函数封装集合
Stars: ✭ 121 (-31.64%)
Mutual labels: utils
Bash Utils
Miscellaneous small utils, mainly for the Bash shell.
Stars: ✭ 121 (-31.64%)
Mutual labels: utils
Touch Bar Istats
Show CPU/GPU/MEM temperature on Touch Bar with BetterTouchTool!
Stars: ✭ 141 (-20.34%)
Mutual labels: utils
React Children Utilities
Extended utils for ⚛️ React.Children data structure that adds recursive filter, map and more methods to iterate nested children.
Stars: ✭ 154 (-12.99%)
Mutual labels: utils
Utils.js
Fast, small and purely functional utility library
Stars: ✭ 102 (-42.37%)
Mutual labels: utils
Torchfunc
PyTorch functions and utilities to make your life easier
Stars: ✭ 177 (+0%)
Mutual labels: utils
Auto Green
自动保持 GitHub 提交状态常绿 a commit every day, keep your girlfriend far away.
Stars: ✭ 164 (-7.34%)
Mutual labels: utils
Rxtool
Android开发人员不得不收集的工具类集合 | 支付宝支付 | 微信支付(统一下单) | 微信分享 | Zip4j压缩(支持分卷压缩与加密) | 一键集成UCrop选择圆形头像 | 一键集成二维码和条形码的扫描与生成 | 常用Dialog | WebView的封装可播放视频 | 仿斗鱼滑动验证码 | Toast封装 | 震动 | GPS | Location定位 | 图片缩放 | Exif 图片添加地理位置信息(经纬度) | 蛛网等级 | 颜色选择器 | ArcGis | VTPK | 编译运行一下说不定会找到惊喜
Stars: ✭ 11,567 (+6435.03%)
Mutual labels: utils
一个面向业务的 JavaScript/TypeScript 实用程序库。
import { md5 } from 'vtils'
console.log(md5('龙'))
// => 682570a229cbd3d67e76ad99b3152060
特性
-
🙅♀️ 拒绝重复:基于社区优质程序库(Lodash、date-fns、react-use、type-fest、ts-essentials、yup 等),补充常用业务代码。
-
🌸 精致优雅:为每一个工具都添加了注释、测试,不看文档亦可直接使用。
-
🌈 面向未来:使用 TypeScript 编写,支持 Tree Shaking、ECMAScript Modules,也可以在 Taro 3、 Deno 中使用。
安装
# npm
npm i vtils
# yarn
yarn add vtils
# pnpm
pnpm add vtils
若在国内,推荐安装 tbify 使用淘宝镜像加速:
# npm
tnpm i vtils
# yarn
tyn add vtils
# pnpm
tpm add vtils
使用
在 NodeJS 中使用
// 基础工具库
import { wait, isNumber, EventBus, base64Encode } from 'vtils'
// 日期时间工具库
import { formatRelative, subDays, zhCN } from 'vtils/date'
// React 工具库
import { useClassName, useToggle, useScrollLoadMore } from 'vtils/react'
// 验证工具库
import { yup } from 'vtils/validator'
// 类型工具库
import { OmitStrict, LiteralUnion, PartialDeep } from 'vtils/types'
// 小程序工具库
import { getTopBarInfo, navigatePageTo, redirectPageTo } from 'vtils/mp'
详细用法见文档:https://fjc0k.github.io/vtils/v4/。
在 Taro 3 中使用
在 Taro 3 中使用前需要修改 Webpack 配置,在 config/index.js
中的 mini
字段下设置:
mini: {
webpackChain(config) {
// 该插件会影响 resolve.extensions 的表现,删去
config.resolve.plugins.delete('MultiPlatformPlugin')
// 支持 .taro.js 后缀
config.resolve.extensions.prepend('.taro.js')
},
}
然后,就可以愉快地使用了:
// React 工具库
import { useSearchParam } from 'vtils/react'
// 小程序工具库
import { useTopBarInfo } from 'vtils/mp'
export default function () {
const id = +useSearchParam('id')!
const topBarInfo = useTopBarInfo()
// ...
}
在 Deno 中使用
Deno 下暂只支持基础工具库。
// 基础工具库
import {
wait,
isNumber,
EventBus,
base64Encode,
} from 'https://cdn.skypack.dev/[email protected]'
许可
Jay Fong (c) MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].