Make jsenv detection conditional without return

This commit is contained in:
Yarmo Mackenbach 2021-04-26 12:28:43 +02:00
parent da59262c45
commit e0dc5f4b21
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
3 changed files with 215 additions and 218 deletions

View file

@ -26,10 +26,6 @@ const jsEnv = require("browser-or-node")
module.exports.timeout = 5000
if (!jsEnv.isNode) {
module.exports.fn = null
return
}
const dns = require('dns')
/**
@ -70,3 +66,6 @@ module.exports.fn = async (data, opts) => {
return result
})
}
} else {
module.exports.fn = null
}

View file

@ -25,11 +25,7 @@ const jsEnv = require("browser-or-node")
*/
module.exports.timeout = 20000
if (!jsEnv.isNode) {
module.exports.fn = null
return
}
if (jsEnv.isNode) {
const irc = require('irc-upd')
const validator = require('validator')
@ -93,3 +89,6 @@ module.exports.fn = async (data, opts) => {
return result
})
}
} else {
module.exports.fn = null
}

View file

@ -25,11 +25,7 @@ const jsEnv = require("browser-or-node")
*/
module.exports.timeout = 5000
if (!jsEnv.isNode) {
module.exports.fn = null
return
}
if (jsEnv.isNode) {
const jsdom = require('jsdom')
const { client, xml } = require('@xmpp/client')
const debug = require('@xmpp/debug')
@ -141,3 +137,6 @@ module.exports.fn = async (data, opts) => {
return result
})
}
} else {
module.exports.fn = null
}