Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const updateRecordWithConceptId = async (collectionRecord) => {
let updatedCollectionRecord = cloneDeep(collectionRecord);
const searchParams = {
short_name: collectionRecord.name || '',
version: collectionRecord.version || '',
provider_short_name: process.env.cmr_provider
};
const cmrResult = await cmrjs.searchConcept('collections', searchParams, []);
let conceptId = null;
if (cmrResult.length === 1) conceptId = cmrResult[0].id;
updatedCollectionRecord = Object.assign(collectionRecord, { conceptId: conceptId });
return updatedCollectionRecord;
};