JSFiddle - React, Tailwind, and code Playground

by karlovac

JavaScript

var valueUsages = {
  "p_21405_ca_47672.p_21405_ca_47674": {
    "vendorId": "32S7GPKK4F-1771",
    "upcharge": {
    "USD": "0.00"
    },
    "active": "true",
    "associatedView": {
    "viewId": "allViews"
    }
  },
  "p_21405_ca_47672.p_21405_ca_47676": {
    "vendorId": "32S7GPKK4F-1771",
    "upcharge": {
    "USD": "0.00"
    },
    "active": "true",
    "associatedView": {
    "viewId": "allViews"
    }
  }


};

function hasVuForCA(productId,caId,valueUsages) {
  for (var i in valueUsages) {
  	var ca = i.substring(i.lastIndexOf('ca_'));
    console.log(ca);
  }
  return false;
}
console.log(hasVuForCA(21405,47676,valueUsages))