Skip to content
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

Have a clear polyfill story #320

Closed
alexreardon opened this issue Feb 12, 2018 · 4 comments
Closed

Have a clear polyfill story #320

alexreardon opened this issue Feb 12, 2018 · 4 comments

Comments

@alexreardon
Copy link
Collaborator

from #319

We are currently using array.prototype.find in a few places which is not awesome for ie11. Either we need to be clear about what polyfills are required, or remove any usages of prototype methods that require > ie 11.

@lukebatchelor
Copy link
Member

Personally I'd be in favour of calling it out in the docs and having a warning presented in the console.

if (!Array.prototype.find) {
  console.warn('Array.prototype.find support not found, please include a polyfill if you would like to support this browser's);
}

Could strip the whole thing out in production builds if you wanted to too.

Ie11 will never support find, so doing anything else would be locking yourself in to including this polyfill everywhere, forever.

If you wanted to be even more explicit, maybe you could use https://github.com/paulmillr/Array.prototype.find instead of Babel polyfill? I think that would be worse in general though, more chance you could miss it, more chance you'd need more polyfills later.

@alexreardon
Copy link
Collaborator Author

Thanks @lukebatchelor

@alexreardon
Copy link
Collaborator Author

I think it might be best just to avoid .find alltogether and use a .filter[0]

@alexreardon
Copy link
Collaborator Author

This will be done as a part of #838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants