-
-
Save stewart/321560330b152dfde649 to your computer and use it in GitHub Desktop.
potential fix for https://github.com/paulmillr/es6-shim/issues/301
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/es6-shim.js b/es6-shim.js | |
index 37ab863..9eefbba 100644 | |
--- a/es6-shim.js | |
+++ b/es6-shim.js | |
@@ -11,20 +11,22 @@ | |
// UMD (Universal Module Definition) | |
// see https://github.com/umdjs/umd/blob/master/returnExports.js | |
(function (root, factory) { | |
+ var global = (function() { return this; })(); | |
+ | |
/*global define, module, exports */ | |
if (typeof define === 'function' && define.amd) { | |
// AMD. Register as an anonymous module. | |
- define(factory); | |
+ define(factory.bind(null, global)); | |
} else if (typeof exports === 'object') { | |
// Node. Does not work with strict CommonJS, but | |
// only CommonJS-like enviroments that support module.exports, | |
// like Node. | |
- module.exports = factory(); | |
+ module.exports = factory(global); | |
} else { | |
// Browser globals (root is window) | |
- root.returnExports = factory(); | |
+ root.returnExports = factory(global); | |
} | |
-}(this, function () { | |
+}(this, function (globals) { | |
'use strict'; | |
var _apply = Function.call.bind(Function.apply); | |
@@ -125,11 +127,6 @@ | |
return String.prototype.startsWith && 'abc'.startsWith('a', Infinity) === false; | |
}()); | |
- /*jshint evil: true */ | |
- var getGlobal = new Function('return this;'); | |
- /*jshint evil: false */ | |
- | |
- var globals = getGlobal(); | |
var globalIsFinite = globals.isFinite; | |
var hasStrictMode = (function () { return this === null; }.call(null)); | |
var startsWithIsCompliant = startsWithRejectsRegex() && startsWithHandlesInfinity; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment