mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
decaf cleanup: rewrite code to no longer use __guard__
GitOrigin-RevId: 591dbefe98423ead89505250c4f46c8ad2610305
This commit is contained in:
parent
291f28a655
commit
ea8e0af551
1 changed files with 2 additions and 21 deletions
|
@ -1,8 +1,3 @@
|
|||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS103: Rewrite code to no longer use __guard__
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const logger = require('@overleaf/logger')
|
||||
const settings = require('@overleaf/settings')
|
||||
|
||||
|
@ -11,16 +6,8 @@ const Server = require('./app/js/server')
|
|||
|
||||
if (!module.parent) {
|
||||
// Called directly
|
||||
const port =
|
||||
__guard__(
|
||||
settings.internal != null ? settings.internal.chat : undefined,
|
||||
x => x.port
|
||||
) || 3010
|
||||
const host =
|
||||
__guard__(
|
||||
settings.internal != null ? settings.internal.chat : undefined,
|
||||
x1 => x1.host
|
||||
) || 'localhost'
|
||||
const port = settings.internal.chat.port
|
||||
const host = settings.internal.chat.host
|
||||
mongodb
|
||||
.waitForDb()
|
||||
.then(() => {
|
||||
|
@ -39,9 +26,3 @@ if (!module.parent) {
|
|||
}
|
||||
|
||||
module.exports = Server.server
|
||||
|
||||
function __guard__(value, transform) {
|
||||
return typeof value !== 'undefined' && value !== null
|
||||
? transform(value)
|
||||
: undefined
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue