I have an object that I need to turn into an array of data, based on a specific key.
Here is my original object:
{
  "centerID": "6",
  "marketID": "1",
  "invoiceGroupID": "4",
  "blocks": [
    {
      "name": "Monday-Friday 11:00AM-3:00PM",
      "isChecked": true
    },
    {
      "name": "Monday-Friday 7:00AM-11:00AM",
      "isChecked": false
    },
    {
      "name": "Saturday-Sunday 2:00PM-8:00PM",
      "isChecked": true
    }
  ],
  "bankedHoursYN": "N"
}
Currently, I am using filter to only provide me the blocks where isChecked = true by using _.filter(this.mappingForm.get('blocks').value, { isChecked: true }).
The result of this leaves me with:
{
  "centerID": "6",
  "marketID": "1",
  "invoiceGroupID": "4",
  "blocks": [
    {
      "name": "Monday-Friday 11:00AM-3:00PM",
      "isChecked": true
    },
    {
      "name": "Saturday-Sunday 2:00PM-8:00PM",
      "isChecked": true
    }
  ],
  "bankedHoursYN": "N"
}
This works fine, leaving me with an array of two objects.
My end result is to just have an array of the name values.
Expected Output:
{
  "centerID": "6",
  "marketID": "1",
  "invoiceGroupID": "4",
  "blocks": ['Monday-Friday 11:00AM-3:00PM','Saturday-Sunday 2:00PM-8:00PM'],
  "bankedHoursYN": "N"
}
Does lodash have a built in way to handle this?
 
     
     
     
     
     
    