-
Notifications
You must be signed in to change notification settings - Fork 17
feat(dt-utils): refactor the dt-utils #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d8de76a
to
f9fb886
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
想到一个问题,这个里面有些 console 是用中文写的,可能源码合并到产品里面之后,中文校验不通过
@@ -0,0 +1,28 @@ | |||
import { nanoid } from 'nanoid'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是否需要单元测试啊
export { default as dayjs } from 'dayjs'; | ||
export * as idb from 'idb'; | ||
export { default as Cookie } from 'js-cookie'; | ||
export * as lodash from 'lodash-es'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些是为了以后大家都走 utils 引入吗?
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB|MDN IndexedDB 使用指南} | ||
* @see {@link https://caniuse.com/#feat=indexeddb|浏览器兼容性} | ||
*/ | ||
class IndexedDB { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个单元测试需要吗?
/** | ||
* IndexedDB | ||
* | ||
* @deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是打了移除标记吗?
text: 'Guide', | ||
items: [ | ||
{ text: 'Quick Start', link: '/quickstart' }, | ||
{ text: 'contribution', link: '/contribution' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contribution 开头应该大写,和其他不统一了。另外这里是不是可以都改成中文的,因为下方方法的目录名称也都是中文
|
||
# Class: ~~IndexedDB~~ | ||
|
||
Defined in: [indexedDB/index.ts:37](https://github.com/DTStack/dt-utils/blob/main/src/indexedDB/index.ts#L37) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defined in 的地址好像都为 main 分支,应该改为 master。另外这个地址是手动维护的吧,后续如果在定义方法的那一行之前添加其他内容,似乎还得修改这里的 Defined 链接
@@ -22,7 +22,7 @@ | |||
|
|||
1、请 `fork` 本项目,`clone` 自己的仓库,按照上述分支定义从 `master` 分支新建 `feat` 分支进行开发,分支命名用下划线加上版本号、功能名,如:`feat_1.x_xxx` | |||
|
|||
2、`feat` 分支开发完毕后,本地执行 `yarn lint` 命令,再执行 `yarn test` 命令,均通过后向相应人员提 PR,期望合入 `release` 分支,待相应人员 review 代码后合入 | |||
2、`feat` 分支开发完毕后,本地执行 `pnpm lint` 命令,再执行 `pnpm test` 命令,均通过后向相应人员提 PR,期望合入 `release` 分支,待相应人员 review 代码后合入 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release 分支基本不用,可以根据实际情况编辑下分支规则
* | ||
* @example | ||
* ```typescript | ||
* import { LocalIndexedDB } from 'dt-utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全局搜 LocalIndexedDB,还残留有四处,应更名为 IndexedDB,记得使用 rebase 到 rename 那个 commit
src/localIndexedDB/index.ts
Outdated
/** | ||
* LocalIndexedDB | ||
* | ||
* @deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
### format | ||
|
||
`string` = `DateTimeFormat.STANDARD` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以链接一下 DateTimeFormat 的内容有哪些
|
||
Defined in: [formatSecond/index.ts:28](https://github.com/DTStack/dt-utils/blob/main/src/formatSecond/index.ts#L28) | ||
|
||
将秒数转换为时间格式 (HH[h]mm[m]ss[s]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 是否可以支持传入
h
,m
,s
这三个单位,比如有些地方需要展示为18分26秒
或运行时长:03:21:18
- HH:mm:ss 是带 0 的,也就是
02h21m18s
这种形式。看是要改文档,还是说要支持传入 format
const parser = new UAParser(); | ||
const result = parser.getOS(); | ||
|
||
return result.name === 'macOS'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


Mac 和 Windows 都需要实际测一下,目前这里判断 name === 'macos' 是不对的
源码:https://github.com/faisalman/ua-parser-js/blob/1.0.x/src/ua-parser.js
|
||
`string` | ||
|
||
— Base64 字符串。支持标准格式和 URL 安全格式 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
`string` | ||
|
||
— UTF-8 字符串 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
开头的这个 —
是中文的吧,没渲染成功
变更类型
请选择以下选项以描述 PR 的类型:
相关问题
变更内容
优化
新增
对应 Previewer
https://jin-sir.github.io/dt-utils/