Getting list of fruits into array list
You can create a fruit with the common properties before the if:

var fruitList = [];
var fruitExpired = GetFruitStatus();
var fruitName = "Mango";
var companyName = "Limited";

var fruit = {
    fruitName: name,
    fruitCompany: companyName
}

if (fruitExpired) {
    fruit.expiredCrate = GetExpiredCrate().ID;
} else {
    fruit.crateId = GetCrate().ID;
}

list.push(fruit);


Also, beware where you put { } in your code, it's not C# and a { after if or else should be on the same line.