Skip to content

Commit

Permalink
update build script and address linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchambers committed Aug 2, 2021
1 parent a6c61ba commit cc289e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"no-undef": ["off"],
"no-unused-vars": ["off"]
}
},
{
"files": "index.js",
"globals": {"globalThis": false}
}
]
}
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
};

/* istanbul ignore else */
if (typeof module === 'object' && module && typeof module.exports === 'object') {
if (
typeof module === 'object' &&
module != null &&
typeof module.exports === 'object'
) {
module.exports = mapping;
} else {
globalThis.FantasyLand = mapping;
Expand Down
8 changes: 6 additions & 2 deletions scripts/generate-js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ cat >index.js <<EOF
};
/* istanbul ignore else */
if (typeof module === 'object' && typeof module.exports === 'object') {
if (
typeof module === 'object' &&
module != null &&
typeof module.exports === 'object'
) {
module.exports = mapping;
} else {
self.FantasyLand = mapping;
globalThis.FantasyLand = mapping;
}
} ());
Expand Down

0 comments on commit cc289e1

Please sign in to comment.