fScope = path.basename(path.dirname(filename));
}
return (scope) => `${fScope}:${scope}`;
-}
+};
/**
* Simple ETag from data.
*/
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);
* @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']),
});
}
-}
+};
/**
const space = authHeader.indexOf(' ');
// This blurs entire string if no space found, because -1.
return authHeader.slice(0, space + 1) + '*'.repeat(authHeader.length - (space + 1));
-}
+};
/**