JSFiddle - React, Tailwind, and code Playground

by Will McKinley

JavaScript

var thing1 = {
	error: false,
  history: [
  	[
    	{
      	id: 1,
        username: null
      },
    	{
      	id: 2,
        username: "Ben"
      },
    	{
      	id: 3,
        username: "Nate"
      }
    ],
  	[
    	{
      	id: 4,
        username: "Julie"
      },
    	{
      	id: 5,
        username: "Clara"
      }
    ]
  ]
};

console.log(thing1);
thing2 = _.cloneDeep(thing1);
_.each(thing2.history, function(array, k){
  thing2.history[k] = _.filter(array, function(v){
    return v.username !== null;
  })
});
console.log(thing2);