From: Justin Wind <justin.wind+git@gmail.com>
Date: Wed, 19 Jul 2023 18:28:15 +0000 (-0700)
Subject: lint cleanup
X-Git-Tag: v1.2.10~5
X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=446a6e8fa160483e1c48a575e60a636c9f37927a;p=squeep-api-dingus

lint cleanup
---

diff --git a/lib/common.js b/lib/common.js
index e2e2a8c..60e0d20 100644
--- a/lib/common.js
+++ b/lib/common.js
@@ -38,7 +38,7 @@ const fileScope = (filename) => {
  */
 const generateETag = (_filePath, fileStat, fileData) => {
   const hash = crypto.createHash('sha256');
-  if (fileStat && fileStat.mtimeMs) {
+  if (fileStat?.mtimeMs) {
     hash.update(fileStat.mtimeMs.toString());
   }
   hash.update(fileData);
@@ -197,7 +197,7 @@ const requestLogData = (req) => {
  * @deprecated after v1.2.5 (integrated into logger module)
  */
 const scrubHeaderObject = (data) => {
-  if (data && data.headers && 'authorization' in data.headers) {
+  if (data?.headers && 'authorization' in data.headers) {
     data.headers = Object.assign({}, data.headers, {
       authorization: obscureAuthorizationHeader(data.headers['authorization']),
     });
diff --git a/lib/content-negotiation.js b/lib/content-negotiation.js
index 1425852..4401374 100644
--- a/lib/content-negotiation.js
+++ b/lib/content-negotiation.js
@@ -20,7 +20,7 @@ class ContentNegotiation {
     if (type) {
       let weight = 1.0;
       params = params.reduce((acc, param) => {
-        const [p, v] = common.splitFirst(param, '=').map((x) => x && x.trim());
+        const [p, v] = common.splitFirst(param, '=').map((x) => x?.trim());
         if (p && v) {
           if (p === 'q') {
             weight = Number(v);
@@ -47,7 +47,9 @@ class ContentNegotiation {
    * @param {string} acceptHeader 
    */
   static _acceptClauses(acceptHeader) {
-    const clauses = (acceptHeader||'').split(',').map((clause) => ContentNegotiation._unpackAcceptClause(clause)).filter((clause) => clause);
+    const clauses = (acceptHeader||'').split(',')
+      .map((clause) => ContentNegotiation._unpackAcceptClause(clause))
+      .filter((clause) => clause);
     return clauses.sort((a, b) => b.weight - a.weight);
   }