Skip to content

Conversation

@jin-sir
Copy link
Collaborator

@jin-sir jin-sir commented Jun 22, 2025

变更类型

请选择以下选项以描述 PR 的类型:

  • Bug 修复(修复现有问题)
  • 新功能(添加了一个功能)
  • 代码优化(性能改进、代码重构)
  • 文档更新
  • 单测新增或修改
  • 其他(请说明):

相关问题

变更内容

优化

  • browserCheck
    • 更名 checkBrowserSupport
    • 使用 ua-parser-js 获取浏览器信息
    • 版本对比精确到小版本
  • copy
    • 使用 Promise 替换 callback
    • 优先使用 navigator.clipboard
  • downLoadData
    • 更名 downloadFile
    • 使用 Promise 替换 callback,且将 Response 作为参数传递
  • convertBytes
    • 更名 formatBytes
    • 新增 decimals 参数,控制小数位数
    • 优化计算逻辑
  • generateAKey、getRandomStr
    • 合并并命名为 getKey
    • 使用 nanoid 生成 key
  • generateFullUrlPath
    • 更名 generateUrlWithQuery
    • 新增 object 和 array 参数的处理:将对象转换为 JSON 字符串
  • getQueryParameters
    • 兼容 generateFullUrlPath ,新增 object 和 array 的解析
  • isMacOs
    • 更名 isMacOS
    • 使用 ua-parser-js 判断
  • isWindows
    • 使用 ua-parser-js 判断
  • isMobileDevice
  • localDB
    • set 支持批量添加
    • clear 支持保留部分 key
  • dateTime
    • 删除 dateTime 中的所有函数,新增 formatDateTime
    • formatDateTime 支持将传入的时间根据传入的格式进行格式化
    • 同时提供 DayjsFormat 枚举,其中包含了常见的时间格式,方便使用
  • getBase64、base64Encode
    • 合并为 toBase64
    • 非文件使用 js-base64 进行编码
  • percent
    • 更名 toPercent
    • 放开最大值 1 的限制
  • exchangeOrder
    • 更名 toSortOrder
  • getThousandth
    • 更名 toThousand

新增

  • formatSecond
    • 格式化秒数:3661 -> 1h1m1s
  • fromBase64
    • 从 js-base64 导出,解码 base64 字符串
  • getTypeOfValue
    • 获取传入的值的类型
  • sessionDB
    • 功能同 localDB

对应 Previewer

https://jin-sir.github.io/dt-utils/

@jin-sir jin-sir requested a review from liuxy0551 June 23, 2025 02:58
@jin-sir jin-sir force-pushed the feat_utils branch 3 times, most recently from d8de76a to f9fb886 Compare August 11, 2025 04:11
Copy link
Contributor

@LuckyFBB LuckyFBB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

想到一个问题,这个里面有些 console 是用中文写的,可能源码合并到产品里面之后,中文校验不通过

@liuxy0551
Copy link
Collaborator

image 这个 commit 的内容好像不太对,似乎是把改文档路径的内容也提进去了

@jin-sir
Copy link
Collaborator Author

jin-sir commented Dec 31, 2025

image 这个 commit 的内容好像不太对,似乎是把改文档路径的内容也提进去了

重新提了

@jin-sir
Copy link
Collaborator Author

jin-sir commented Dec 31, 2025

想到一个问题,这个里面有些 console 是用中文写的,可能源码合并到产品里面之后,中文校验不通过

不会的,我看了那个中文是文档里的,方法中没有用到中文

@liuxy0551
Copy link
Collaborator

Perfect~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants