Просмотр исходного кода

Decaf cleanup: remove __guard__()

Eric Mc Sween 6 лет назад
Родитель
Сommit
18b92adcef
1 измененных файлов с 5 добавлено и 15 удалено
  1. 5 15
      services/document-updater/app.js

+ 5 - 15
services/document-updater/app.js

@@ -1,6 +1,5 @@
 /*
  * decaffeinate suggestions:
- * DS103: Rewrite code to no longer use __guard__
  * DS207: Consider shorter variations of null checks
  * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  */
@@ -216,16 +215,13 @@ for (const eventName of events) {
 }
 
 const port =
-  __guard__(
-    Settings.internal != null ? Settings.internal.documentupdater : undefined,
-    (x) => x.port
-  ) ||
-  __guard__(
-    Settings.apis != null ? Settings.apis.documentupdater : undefined,
-    (x1) => x1.port
-  ) ||
+  Settings.internal.documentupdater.port ||
+  (Settings.api &&
+    Settings.api.documentupdater &&
+    Settings.api.documentupdater.port) ||
   3003
 const host = Settings.internal.documentupdater.host || 'localhost'
+
 if (!module.parent) {
   // Called directly
   app.listen(port, host, () => {
@@ -250,9 +246,3 @@ for (const signal of [
 ]) {
   process.on(signal, shutdownCleanly(signal))
 }
-
-function __guard__(value, transform) {
-  return typeof value !== 'undefined' && value !== null
-    ? transform(value)
-    : undefined
-}