JSFiddle - React, Tailwind, and code Playground

by henser

JavaScript

const defaultShareClassChartStyle = {
  common: {
    name: "Common",
    colors: {
      background: "rgba(255, 99, 132, 0.2)",
      border: "rgba(255, 99, 132, 1)",
    },
  },
  preferred_a: {
    name: "Preferred A",
    colors: {
      background: "rgba(54, 162, 235, 0.2)",
      border: "rgba(54, 162, 235, 1)",
    },
  },
  preferred_b: {
    name: "Preferred B",
    colors: {
      background: "rgba(255, 206, 86, 0.2)",
      border: "rgba(255, 206, 86, 1)",
    },
  },
  preferred_c: {
    name: "Preferred C",
    colors: {
      background: "rgba(75, 192, 192, 0.2)",
      border: "rgba(75, 192, 192, 1)",
    },
  },
};

console.log(Object.values(defaultShareClassChartStyle).map(
              (item) => item.name
            ),);