pass correct key to sanitize callback

This commit is contained in:
Moriz Wahl 2022-11-24 18:28:02 +01:00
parent 3e6566bff5
commit 266d846012

View File

@ -12,7 +12,7 @@ function walkRecursive(data, fields, fieldName, callback, _key) {
if (data && typeof data === 'string' && fields.includes(_key)) {
// well we found what we searched for, lets replace the value with our callback result
const key = _key.split('!')
if (key.length === 1 || key[1] !== fieldName) data = callback(data, _key)
if (key.length === 1 || key[1] !== fieldName) data = callback(data, key[0])
} else if (data && Array.isArray(data)) {
// go into the rabbit hole and dig through that array
data.forEach((res, index) => {