fix: polyfill Object.hasOwn for node 14#4152
fix: polyfill Object.hasOwn for node 14#4152straker merged 1 commit intodequelabs:developfrom ljharb:hasown
Conversation
straker
left a comment
There was a problem hiding this comment.
Thanks for taking on fixing < node 14.
It looks like core-js provides an implementation for Object.hasOwn, which we already depend on. We should use that one rather than bring in another dependency.
Also, the way we handle doing these types of polyfills in axe-core is to add them to the imports file and only apply the polyfill if the current implementation does not exist. That way we don't have to rewrite every use of the function and can easily remove it when we don't need the polyfill anymore.
import hasOwn from 'core-js-pure/actual/object/has-own';
if (!('hasOwn' in Object) {
Object.hasOwn = hasOwn;
}|
Sounds good, done. It seems like tests aren't running in every supported version of node, which would have caught this as well as #4127. I'm not familiar enough with circle to fix that myself, but it'd be great if someone was able to do that separately :-) |
|
Yep, was actually looking into that myself to see what it would entail. |
|
Approved for security |
|
Thanks! I ran |
|
Hopefully this will make it into v4.8.2? |
|
Yep, I forgot I wanted this into the 4.8.1 release before we made it. |
|
@ljharb we released this as part of axe-core v4.8.2 |
|
Thank you! |
From #4060; fixes jsx-eslint/eslint-plugin-jsx-a11y#953.