elasticlunr

utils

property
elasticlunr.utils

A namespace containing utils for the rest of the elasticlunr library

elasticlunr.utils = {};

warn

property
elasticlunr.utils.warn

Option name Type Description
message String

The message to be printed.

Print a warning message to the console.

elasticlunr.utils.warn = (function (global) {
  return function (message) {
    if (global.console && console.warn) {
      console.warn(message);
    }
  };
})(this);

toString

method
elasticlunr.utils.toString()

Option name Type Description
obj object

The object to convert to a string.

return String

string representation of the passed object.

Convert an object to string.

In the case of null and undefined the function returns
an empty string, in all other cases the result of calling
toString on the passed object is returned.

elasticlunr.utils.toString = function (obj) {
  if (obj === void 0 || obj === null) {
    return "";
  }

  return obj.toString();
};