X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fcommon.js;fp=lib%2Fcommon.js;h=723f922b20930355d6adc53ead1fc97f6e719597;hb=a90b9c1b279773c225560aa3ae5f5f21424ec420;hp=e2e2a8c640f58ba4df827cd6e7afcc5ffb69fd4b;hpb=3b15b5ff792fc5d61be8337989058c297460cd99;p=squeep-api-dingus diff --git a/lib/common.js b/lib/common.js index e2e2a8c..723f922 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']), }); @@ -289,6 +289,7 @@ const nullLogger = { * Populates any absent logger level functions on a logger object. * @param {Object} logger * @returns {Object} + * @deprecated after v1.2.9 (this is not our responsibility) */ const ensureLoggerLevels = (logger = {}) => { for (const level in nullLogger) { @@ -307,7 +308,7 @@ const ensureLoggerLevels = (logger = {}) => { const unfoldHeaderLines = (lines) => { const foldedLineRE = /^(\t| +)(.*)$/; if (lines) { - lines.reduceRight((_, line, idx) => { + lines.reduceRight((_, line, idx) => { // NOSONAR const result = foldedLineRE.exec(line); if (result && idx) { const prevIdx = idx - 1;