Skip to content

Commit

Permalink
fix: remove the trailing comma after the last SKU (frappe#201)
Browse files Browse the repository at this point in the history
Instead of using the reduce() method to explode the list of SKUs into separate objects, we can use the map() method and get rid of the trailing comma after the last SKU
  • Loading branch information
shashankshirke authored Sep 5, 2022
1 parent d3a6c9a commit 2894160
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ shopify.ProductImporter = class {
// 'Image': product.image && product.image.src && `<img style="height: 50px" src="${product.image.src}">`,
'ID': product.id,
'Name': product.title,
'SKUs': product.variants && product.variants.reduce((a, b) => a + `${b.sku}, `, ''),
'SKUs': product.variants && product.variants.map(a => `${a.sku}`).join(', '),
'Status': this.getProductSyncStatus(product.synced),
'Action': !product.synced ? `<button type="button" class="btn btn-default btn-xs btn-sync mx-2" data-product="${product.id}"> Sync </button>` : '-',
}));
Expand Down

0 comments on commit 2894160

Please sign in to comment.