-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: rewrite defineObjectProp logic #6556
Conversation
…e coverage - Refactored logic to handle `null` and `undefined` parameters for proper storage. - Used `Object.assign` to merge objects without altering the outer reference. - Improved branching to handle different argument types clearly. - Enhanced code readability and extensibility. - Added 6551 test cases to ensure thorough validation of edge cases.
Pull Request Test Coverage Report for Build 12326417729Details
💛 - Coveralls |
|
||
case 2: | ||
currentObj[key] = value; | ||
return this.attr(k, currentObj); |
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.
感觉写法也有点复杂了😵💫
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.
是逻辑上的精简还是写法上的精简呢?逻辑优化上没有特别好的想法了,感觉逻辑再优化单测就出问题了 😵💫
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.
逻辑省不了,就是代码上了~我想想怎么归归类~
@BQXBQX 仔细想了一下,感觉不是很好规整。当前
chart.newAPI({ globalXXX: true })
所以建议:
你看看觉得如何? |
好的,那我把文档说明加在 |
需要在 这里 写的,这个文档目前都还没有 interaction 的 API。 export const commonProps = {
encode: { type: 'object' },
scale: { type: 'object' },
data: { type: 'value' },
transform: { type: 'array' },
style: { type: 'object' },
animate: { type: 'object' },
coordinate: { type: 'object' },
interaction: { type: 'object' },
label: { type: 'array', key: 'labels' },
axis: { type: 'object' },
legend: { type: 'object' },
slider: { type: 'object' },
scrollbar: { type: 'object' },
state: { type: 'object' },
layout: { type: 'object' },
theme: { type: 'object' },
title: { type: 'value' },
} as const; 理论上,上面 type 是 object 的都是走的这个逻辑。 |
要是 type 是 object 都会出现这种情况,把这个问题放到 interaction 是不是有点不合适 🤕 |
感觉冗余点,都要加,这个就是文档难搞的一个点,跟着代码有区别。 |
要不这个先 hold 吧,明年我们做文档优化,一起来处理。 |
Checklist
npm test
passesDescription of change
null
andundefined
parameters for proper storage.Object.assign
to merge objects without altering the outer reference.