Skip to content

Refactor: drop es5-ext #473

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions lib/browser.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
var _globalThis;
if (typeof globalThis === 'object') {
_globalThis = globalThis;
} else {
try {
_globalThis = require('es5-ext/global');
} catch (error) {
} finally {
if (!_globalThis && typeof window !== 'undefined') { _globalThis = window; }
if (!_globalThis) { throw new Error('Could not determine global this'); }
}

/**
* core-js | Denis Pushkarev (zloirock) | MIT License
*
* https://github.com/zloirock/core-js/blob/977a3a49eb9473edf470cbc5c4257bd7c8c4da33/packages/core-js/internals/global-this.js#L1
*/
var checkGlobal = function (it) {
return it && it.Math === Math && it;
};
var _globalThis =
checkGlobal(typeof globalThis === 'object' && globalThis) ||
checkGlobal(typeof window === 'object' && window) ||
checkGlobal(typeof self === 'object' && self) ||
checkGlobal(typeof global === 'object' && global) ||
checkGlobal(typeof this === 'object' && this) ||
(function () { return this; })();

if (!_globalThis) {
throw new Error('Could not determine global this');
}

var NativeWebSocket = _globalThis.WebSocket || _globalThis.MozWebSocket;
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"dependencies": {
"bufferutil": "^4.0.1",
"debug": "^2.2.0",
"es5-ext": "^0.10.63",
"typedarray-to-buffer": "^3.1.5",
"utf-8-validate": "^5.0.2",
"yaeti": "^0.0.6"
Expand All @@ -38,8 +37,8 @@
"buffer-equal": "^1.0.0",
"gulp": "^4.0.2",
"gulp-jshint": "^2.0.4",
"jshint-stylish": "^2.2.1",
"jshint": "^2.0.0",
"jshint-stylish": "^2.2.1",
"tape": "^4.9.1"
},
"config": {
Expand Down