kentcdodds / match-sorter

Simple, expected, and deterministic best-match sorting of an array in JavaScript

Home Page:https://npm.im/match-sorter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Polyfill for IE11 - String.prototype.includes

luish opened this issue · comments

match-sorter: 2.2.1
node: v6.11.3
npm: 5.6.0

We've been using this lib and it failed on Internet Explorer 11 because of the following line:

const containsDash = testString.includes('-')

Object doesn’t support property or method ‘includes’

So I'm wondering if I could contribute to this repo by adding a polyfill such as these ones:

Thanks :)

Thanks for the issue. Rather than including a polyfill in the library, let's add a note to the README that applications using this library should include polyfills for older browsers. Small libraries like this one should not include polyfills.

Thanks for the reply, @kentcdodds.
Sounds good to me. Another alternative would be just replacing includes with indexOf() >= 0, and therefore the lib could be used without polyfills on the application side. What do you think?

That'd be fine with me.

🎉 This issue has been resolved in version 2.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀