Skip to content

Commit

Permalink
[Refactor] avoid top-level return, because babel and webpack are broken
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 17, 2019
1 parent db358ba commit 4f9eeee
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Expand Up @@ -3,27 +3,27 @@
var $Map = typeof Map === 'function' && Map.prototype ? Map : null;
var $Set = typeof Set === 'function' && Set.prototype ? Set : null;

var exported;

if (!$Set) {
// eslint-disable-next-line no-unused-vars
module.exports = function isSet(x) {
exported = function isSet(x) {
// `Set` is not present in this environment.
return false;
};
return;
}

var $mapHas = $Map ? Map.prototype.has : null;
var $setHas = $Set ? Set.prototype.has : null;
if (!$setHas) {
if (!exported && !$setHas) {
// eslint-disable-next-line no-unused-vars
module.exports = function isSet(x) {
exported = function isSet(x) {
// `Set` does not have a `has` method
return false;
};
return;
}

module.exports = function isSet(x) {
module.exports = exported || function isSet(x) {
if (!x || typeof x !== 'object') {
return false;
}
Expand Down

0 comments on commit 4f9eeee

Please sign in to comment.