[mapguide-users] fusion error - searchStr.test is not a function

sebafr sebafr at gmail.com
Wed Apr 4 10:03:17 PDT 2018


Today, all off ours mapguide servers (5 different places, 2 different
versions) happened this error:

fusionSF.js:132996 Uncaught TypeError: searchStr.test is not a function

Looking at fusionSF,js i found this code:

...
Array.prototype.find = function(searchStr) {
  var returnArray = null;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      if (searchStr.test(this[i])) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
};


Somebody knows whats happens ? 

I comment the lines below and everything works again, apparently well, but I
wanted to know why?

...
Array.prototype.find = function(searchStr) {
  var returnArray = null;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      //if (searchStr.test(this[i])) {
      //  if (!returnArray) { returnArray = [] }
      //  returnArray.push(i);
      //}
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
};

thanks in advance
sebafr



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html


More information about the mapguide-users mailing list