Skip to content

Instantly share code, notes, and snippets.

@rajaramtt
Last active September 14, 2020 19:54
Show Gist options
  • Save rajaramtt/fd5e18bbe3b0c51d42f54b233da2c36e to your computer and use it in GitHub Desktop.
Save rajaramtt/fd5e18bbe3b0c51d42f54b233da2c36e to your computer and use it in GitHub Desktop.
/*
{
"goodPackage": {
"upsellList": [
{
"productCode": "product1"
}
]
},
"betterPackage": {
"upsellList": [
{
"productCode": "product2"
}
]
},
"bestPackage": {
"upsellList": [
{
"productCode": "product4"
},
{
"productCode": "product3"
}
]
}
}
*/
const betterPackageCodes = this.hostingUpsellProducts.bestPackage.upsellList.map(prod => ([prod.productCode]));
/*
[
{
"name": "Prod 1",
"productCode": "prod1",
},
{
"name": "Prod 2",
"productCode": "prod2",
},
{
"name": "Product 3",
"productCode": "prod3",
}
]
*/
const selectedProducts = this.selectedProduct.map(prod => ({ productCode: prod.productCode })); // only get the prodcts
const uniqueChannelID = Number([...new Set(array)].join());
@rajaramtt
Copy link
Author

rajaramtt commented Sep 14, 2020

    const qwerwqe = this.dddd.map(dddd=> {
      if (dddd.selected) {
        return dddd.dfas;
      }
    }).filter(notUndefined => notUndefined !== undefined);

@rajaramtt
Copy link
Author

Remove Duplicates 

    const channelID = this.selectedProduct.map(prod => (prod.productId));
    const uniqueChannelID = Number([...new Set(channelID)].join());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment