Newbie question, I'm working with a npm package and I would like to modify the original function but haven't got much luck trying. The function I'm trying to modify:
AnimationItem.prototype.getMarkerData = (markerName: string) => {
let marker;
for (let i = 0; i < this.markers.length; i += 1) {
marker = this.markers[i];
if (marker.payload && marker.payload.name === markerName) {
return marker;
}
}
return null;
};
I want to replace this condition:
if (marker.payload && marker.payload.name === markerName)
with this:
if (marker.payload && marker.payload.name.cm === markerName)
Things I've tried so far:
- Use
patch-package
: I got some weird error similar to this but haven't got any fix so far.
I'm trying to override the prototype locally in my React component (until the PR to fix this issue is merge in the source code) but I'm not sure how should I go about it, any suggestion would be appreciated! Thanks.