*/
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']),
});
* 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) {
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;