Skip to content

Commit

Permalink
refactor: sanitize taxonomies & term
Browse files Browse the repository at this point in the history
  • Loading branch information
aman19K committed Oct 5, 2023
1 parent c3b27c8 commit 9b16d62
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/contentstack-export-to-csv/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,11 @@ async function apiRequestHandler(payload, skip, limit) {
function formatTaxonomiesData(taxonomies) {
if (taxonomies?.length) {
const formattedTaxonomies = taxonomies.map((taxonomy) => {
let obj = {
return sanitizeData({
'Taxonomy UID': taxonomy.uid,
Name: taxonomy.name,
Description: taxonomy.description,
};
obj = sanitizeData(obj);
return obj;
});
});
return formattedTaxonomies;
}
Expand All @@ -808,14 +806,12 @@ function formatTaxonomiesData(taxonomies) {
function formatTermsOfTaxonomyData(terms, taxonomyUID) {
if (terms?.length) {
const formattedTerms = terms.map((term) => {
let obj = {
return sanitizeData({
'Taxonomy UID': taxonomyUID,
UID: term.uid,
Name: term.name,
'Parent UID': term.parent_uid,
}
obj = sanitizeData(obj);
return obj;
});
});
return formattedTerms;
}
Expand Down Expand Up @@ -864,5 +860,5 @@ module.exports = {
formatTaxonomiesData,
formatTermsOfTaxonomyData,
getTaxonomy,
getStacks
getStacks,
};

0 comments on commit 9b16d62

Please sign in to comment.