浏览代码

fix: fix error handling for outdated node versions

KernelDeimos 1 年之前
父节点
当前提交
4c1d5a4b6d
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      run-selfhosted.js

+ 10 - 0
run-selfhosted.js

@@ -93,6 +93,16 @@ const early_init_errors = [
     }
 ];
 
+// null coalescing operator
+const nco = (...args) => {
+    for ( const arg of args ) {
+        if ( arg !== undefined && arg !== null ) {
+            return arg;
+        }
+    }
+    return undefined;
+}
+
 const _print_error_help = (error_help) => {
     const lines = [];
     lines.push(nco(error_help.title, error_help.text));