Skip to content

global is undefined in strict mode #324

@stkevintan

Description

@stkevintan

I'm using lunr with es6 syntax which need babel to compile. but babel will always enable the strict mode which will make an error in following source code:

lunr.utils.warn = (function (global) {
  /* eslint-disable no-console */
  return function (message) {
    if (global.console && console.warn) {
      console.warn(message);
    }
  }
  /* eslint-enable no-console */
})(this);

this in strict mode will be undefined instead of the window object .

By the way, I don't understand why using global.console instead of console, is it necessary for some edge case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions