Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (_.has(place, 'name.default')) {
doc.name = field.getStringValue(place.name.default);
} else {
logger.warn(`doc ${doc.gid} does not contain name.default`);
}
// assign all the details info into the doc
Object.assign(doc, collectDetails(params, place));
// add addendum data if available
// note: this should be the last assigned property, for aesthetic reasons.
if (_.has(place, 'addendum')) {
let addendum = {};
for(let namespace in place.addendum){
try {
addendum[namespace] = codec.decode(place.addendum[namespace]);
} catch( e ){
logger.warn(`doc ${doc.gid} failed to decode addendum namespace ${namespace}`);
}
}
if( Object.keys(addendum).length ){
doc.addendum = addendum;
}
}
return doc;
}