-
Notifications
You must be signed in to change notification settings - Fork 76
Conversation
tests for eventKey
const accessor = { | ||
x: Helpers.createAccessor(props.x !== undefined ? props.x : "x"), | ||
y: Helpers.createAccessor(props.y !== undefined ? props.y : "y"), | ||
y0: Helpers.createAccessor(props.y0 !== undefined ? props.y0 : "y0") | ||
}; | ||
const data = dataset.map((datum, index) => { | ||
|
||
const data = dataset.reduce((dataArr, datum, index) => { // eslint-disable-line complexity |
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.
using reduce
here because js arrays and immutable
List
s both have reduce
and we can then return a regular array.
src/victory-util/helpers.js
Outdated
} | ||
} | ||
return property(key)(x); | ||
}; |
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.
This is more of a nice-to-have. People could just always specify an accessor function if they are passing in an immutable
object.
return prev; | ||
}, this.isList(x) ? [] : {}) : x; | ||
} | ||
}; |
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.
these methods should work for immutable@v3.8.x
(current latest version) as well as for v4.0.x
(in release candidate phase) when it is released.
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.
Works well for me!
shallowly converts
data
prop fromimmutable
object to js, preserving all props in each data point withindata
.corresponding PR in victory chart: FormidableLabs/victory-chart#542
x
andy
accessors and other props likeanimate
that can take a function with adatum
argument will receive a shallowly converteddatum
(datum
will be a js plain object, but the keys will be in their original forms with a few exceptions).i.e.