Skip to content

Commit

Permalink
make reference to global conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinsw committed May 22, 2024
1 parent 740e30f commit a315b8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

const defaults = require('./defaults');
const {Utils} = require('./utils');
const fetch = global.fetch || require('cross-fetch');
const _g = typeof window === 'object' ? window : (typeof global === 'object' ? global : {});
const fetch = _g.fetch || require('cross-fetch');

function includesTextCI(arr, texts) {
// string entries in which one of it must exist in the array, eg ['a','b']
Expand Down
3 changes: 2 additions & 1 deletion lib/rocrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//@ts-check

const fetch = global.fetch || require('cross-fetch');
const _g = typeof window === 'object' ? window : (typeof global === 'object' ? global : {});
const fetch = _g.fetch || require('cross-fetch');
const defaults = require('./defaults');
const { Utils } = require('./utils');
const { Node, Handler, ArrayHandler, Symbols } = require('./node');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ro-crate",
"version": "3.3.8",
"version": "3.3.9",
"description": "Research Object Crate (RO-Crate) utilities for making and consuming crates",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a315b8b

Please sign in to comment.