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

A more reliable method to get the global object #259

Merged
merged 1 commit into from
Jun 12, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
A more reliable method to get the global object
  • Loading branch information
ljharb committed Jun 11, 2014
commit ceeb51cc99bbe3729e96eae8c7af966a2d67dfde
6 changes: 5 additions & 1 deletion es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
return rejectsRegex;
};

/*jshint evil: true */
var getGlobal = new Function('return this;');
/*jshint evil: false */

var main = function() {
var globals = (typeof global === 'undefined') ? self : global;
var globals = getGlobal();
var global_isFinite = globals.isFinite;
var supportsDescriptors = !!Object.defineProperty && arePropertyDescriptorsSupported();
var startsWithIsCompliant = startsWithRejectsRegex();
Expand Down