@shawnvogt/strapi-plugin-google-translate
Version:
Strapi plugin for automated translation of content using Google Cloud Translation
23 lines (19 loc) • 499 B
JavaScript
// recursively remove the id property from an object
const stripIds = async (obj, preserveUpstreamRelations) => {
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
if (key === 'id') {
delete obj[key]
} else if (typeof obj[key] === 'object') {
if (!preserveUpstreamRelations.includes(key)) {
stripIds(obj[key], preserveUpstreamRelations)
}
}
}
}
return obj
}
module.exports = {
stripIds,
}