Skip to content
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

feat: add a util to calculate max and min number & omit #58

Merged
merged 5 commits into from
Feb 10, 2021
Merged

Conversation

visiky
Copy link
Member

@visiky visiky commented Feb 9, 2021

增加了 max, minomit util, 修复了 get-range 遇到极大数量出错的问题

packages/util/__tests__/unit/max-spec.js Show resolved Hide resolved
* // Math.max(...data) will encounter "Maximum call stack size exceeded" error
*/
export default (arr: number[]): number | undefined => {
return maxBy(arr, (d) => d);
Copy link
Member

Choose a reason for hiding this comment

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

可以 max(...arr) 吗?

Copy link
Member Author

Choose a reason for hiding this comment

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

? max(...arr), 没有 max 方法,还是说不直接使用 maxBy 了,自己写一个

Copy link
Member Author

Choose a reason for hiding this comment

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

max, min 用更简洁的方式实现了

@hustcc
Copy link
Member

hustcc commented Feb 9, 2021

直接升级版本,然后合并之后打包。

@visiky visiky changed the title feat(util-max): add a util to calculate max number feat(util-max): add a util to calculate max and min number Feb 9, 2021
@visiky visiky changed the title feat(util-max): add a util to calculate max and min number feat: add a util to calculate max and min number & omit Feb 9, 2021
return r;
},
{}
);
Copy link
Member

Choose a reason for hiding this comment

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

这个的性能有优化空间。年后处理吧!

@hustcc hustcc merged commit 43399e0 into master Feb 10, 2021
@hustcc hustcc deleted the feat-max branch February 10, 2021 05:48
@hustcc
Copy link
Member

hustcc commented Feb 10, 2021

已经发包。

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

Successfully merging this pull request may close these issues.

2 participants