-
Notifications
You must be signed in to change notification settings - Fork 27
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
Conversation
packages/util/src/max.ts
Outdated
* // Math.max(...data) will encounter "Maximum call stack size exceeded" error | ||
*/ | ||
export default (arr: number[]): number | undefined => { | ||
return maxBy(arr, (d) => d); |
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.
可以 max(...arr) 吗?
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.
? max(...arr)
, 没有 max 方法,还是说不直接使用 maxBy 了,自己写一个
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.
max, min 用更简洁的方式实现了
直接升级版本,然后合并之后打包。 |
return r; | ||
}, | ||
{} | ||
); |
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.
这个的性能有优化空间。年后处理吧!
已经发包。 |
增加了
max
,min
和omit
util, 修复了get-range
遇到极大数量出错的问题