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

Object doesn't support property or method 'find' - IE 11 #578

Closed
aleplusplus opened this issue Oct 19, 2018 · 1 comment
Closed

Object doesn't support property or method 'find' - IE 11 #578

aleplusplus opened this issue Oct 19, 2018 · 1 comment
Assignees
Labels
good first issue 👋 Issues ideal to start contributing to this repo web 🕸️ Issues related to Web version of library
Milestone

Comments

@aleplusplus
Copy link

aleplusplus commented Oct 19, 2018

Issue Type:
Bug

Platform:
ReactiveSearch for Web

Description:
Object doesn't support property or method 'find'

Screenshots:
screen shot 2018-10-19 at 12 51 18 pm

Reactivesearch version: 2.12.1

Browser: IE 11

Anything else:
https://stackoverflow.com/questions/37788536/object-doesnt-support-property-or-method-find-in-ie
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find

// https://tc39.github.io/ecma262/#sec-array.prototype.find
if (!Array.prototype.find) {
  Object.defineProperty(Array.prototype, 'find', {
    value: function(predicate) {
     // 1. Let O be ? ToObject(this value).
      if (this == null) {
        throw new TypeError('"this" is null or not defined');
      }

      var o = Object(this);

      // 2. Let len be ? ToLength(? Get(O, "length")).
      var len = o.length >>> 0;

      // 3. If IsCallable(predicate) is false, throw a TypeError exception.
      if (typeof predicate !== 'function') {
        throw new TypeError('predicate must be a function');
      }

      // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
      var thisArg = arguments[1];

      // 5. Let k be 0.
      var k = 0;

      // 6. Repeat, while k < len
      while (k < len) {
        // a. Let Pk be ! ToString(k).
        // b. Let kValue be ? Get(O, Pk).
        // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
        // d. If testResult is true, return kValue.
        var kValue = o[k];
        if (predicate.call(thisArg, kValue, k, o)) {
          return kValue;
        }
        // e. Increase k by 1.
        k++;
      }

      // 7. Return undefined.
      return undefined;
    },
    configurable: true,
    writable: true
  });
}
@metagrover
Copy link
Contributor

Hi @aleplusplus, thanks for reporting this. I will include this in the next release.


For now, anyone facing this issue - you can add the polyfill in your app.

@metagrover metagrover added good first issue 👋 Issues ideal to start contributing to this repo web 🕸️ Issues related to Web version of library labels Oct 23, 2018
@metagrover metagrover added this to the 3.0.0 milestone Oct 23, 2018
@siddharthlatest siddharthlatest assigned jyash97 and unassigned bietkul Oct 25, 2018
metagrover pushed a commit that referenced this issue Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue 👋 Issues ideal to start contributing to this repo web 🕸️ Issues related to Web version of library
Projects
None yet
Development

No branches or pull requests

4 participants