Files
klz-cables.com/.pnpm-store/v10/files/d0/f2877f4477129f72e1f544289b6d3b72f611ab0caa7ab9fb0218191f3c549f6ce70c7e3efa91c2c4660d77defd45d5e5637453430758dddee9c53a12d0298e
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

29 lines
966 B
Plaintext

'use strict'
module.exports = deleteLogProperty
const getPropertyValue = require('./get-property-value')
const splitPropertyKey = require('./split-property-key')
/**
* Deletes a specified property from a log object if it exists.
* This function mutates the passed in `log` object.
*
* @param {object} log The log object to be modified.
* @param {string} property A string identifying the property to be deleted from
* the log object. Accepts nested properties delimited by a `.`
* Delimiter can be escaped to preserve property names that contain the delimiter.
* e.g. `'prop1.prop2'` or `'prop2\.domain\.corp.prop2'`
*/
function deleteLogProperty (log, property) {
const props = splitPropertyKey(property)
const propToDelete = props.pop()
log = getPropertyValue(log, props)
/* istanbul ignore else */
if (log !== null && typeof log === 'object' && Object.prototype.hasOwnProperty.call(log, propToDelete)) {
delete log[propToDelete]
}
}