inexorabletash / polyfill

JavaScript Polyfills, Shims and More
Other
1.36k stars 354 forks source link

Functions unification and fix babel transpile #155

Open AlikDex opened 5 years ago

inexorabletash commented 4 years ago

Hmmm... the use of self is fine in browsers (which is what I mostly care about) but in Node environments it won't be present and some folks do use it there and complain...

Mouvedia commented 4 years ago

If you wanna pass a global root here's the right argument :


(function () {
  try {
    return Function('return this')() || (42, eval)('this');
  } catch (e) {
    return self;
  }
})()