
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
@jiayouzuo/uniapp-shared-js
Advanced tools
uni-app 通用工具函数库
npm install @jiayouzuo/uniapp-shared-js
| 导出项 | 类型 | 作用 |
|---|---|---|
createRequest | 函数 | 创建请求实例,支持自动重试、401重登录、文件上传 |
ApiResponse | 类型 | 响应数据结构 |
RequestOptions | 类型 | 请求配置 |
UploadOptions | 类型 | 上传配置 |
RequestConfig | 类型 | 请求实例配置 |
| 导出项 | 类型 | 作用 |
|---|---|---|
setStorage | 函数 | 设置存储,支持过期时间 |
getStorage | 函数 | 获取存储,自动处理过期 |
removeStorage | 函数 | 移除存储 |
clearStorage | 函数 | 清空存储 |
StorageOptions | 类型 | 存储配置 |
| 导出项 | 类型 | 作用 |
|---|---|---|
createTimer | 函数 | 创建定时器,支持立即执行、次数限制 |
createCountdown | 函数 | 创建倒计时定时器 |
delay | 函数 | 延时执行(Promise版本) |
debounce | 函数 | 防抖函数 |
throttle | 函数 | 节流函数 |
TimerOptions | 类型 | 定时器配置 |
TimerInstance | 类型 | 定时器实例 |
| 导出项 | 类型 | 作用 |
|---|---|---|
jsonParse | 函数 | 安全的JSON解析,失败返回默认值 |
jsonStringify | 函数 | 安全的JSON序列化,失败返回默认值 |
toNumber | 函数 | 安全的数字转换,失败返回默认值 |
arrayAt | 函数 | 安全的数组访问,越界返回默认值 |
| 导出项 | 类型 | 作用 |
|---|---|---|
aesCBCDecrypt | 函数 | AES-CBC解密 |
aesCBCEncrypt | 函数 | AES-CBC加密 |
base64Encode | 函数 | Base64编码 |
base64Decode | 函数 | Base64解码 |
simpleHash | 函数 | 简单哈希(非安全场景) |
| 导出项 | 类型 | 作用 |
|---|---|---|
uuid | 函数 | 生成UUID v4 |
shortId | 函数 | 生成短ID(8位) |
timestampId | 函数 | 生成时间戳ID |
| 导出项 | 类型 | 作用 |
|---|---|---|
createWebSocketManager | 函数 | 创建WebSocket管理器,支持心跳、自动重连、消息分发 |
WebSocketOptions | 类型 | WebSocket配置 |
WebSocketMessage | 类型 | WebSocket消息结构 |
WebSocketManager | 类型 | WebSocket管理器实例 |
| 导出项 | 类型 | 作用 |
|---|---|---|
getUserDir | 函数 | 获取用户文件根目录 |
resolvePath | 函数 | 拼接完整文件路径 |
writeFile | 函数 | 写入文件 |
readFile | 函数 | 读取文件 |
appendFile | 函数 | 追加内容到文件末尾 |
removeFile | 函数 | 删除文件 |
copyFile | 函数 | 复制文件 |
renameFile | 函数 | 重命名/移动文件 |
mkdir | 函数 | 创建目录(支持递归) |
rmdir | 函数 | 删除目录 |
readDir | 函数 | 读取目录内容 |
readDirWithStats | 函数 | 读取目录详细内容(含文件信息) |
getFileStats | 函数 | 获取文件/目录信息 |
exists | 函数 | 检查文件/目录是否存在 |
getFileSize | 函数 | 获取文件大小 |
saveTempFile | 函数 | 保存临时文件到用户目录 |
readJSON | 函数 | 读取JSON文件 |
writeJSON | 函数 | 写入JSON文件 |
clearDir | 函数 | 清空指定目录下的所有文件 |
| 导出项 | 类型 | 作用 |
|---|---|---|
formatDate | 函数 | 格式化时间,返回多种格式(formatted、dateStr、timeStr、relative等) |
DateResult | 类型 | 时间格式化结果 |
| 导出项 | 类型 | 作用 |
|---|---|---|
formatThousand | 函数 | 千分位格式化 |
formatNumber | 函数 | 数字简化显示(1.2万、1.2亿) |
formatFileSize | 函数 | 格式化文件大小(KB、MB、GB) |
formatPercent | 函数 | 格式化百分比 |
FormatNumberOptions | 类型 | 数字简化配置 |
MIT
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.