TypeError: Cannot read property 'name' of undefined ionic
var availableDevices = Object.keys(devices).reduce(function (availAcc, deviceCategory) {
var availableDevicesInCategory = devices[deviceCategory];
availableDevicesInCategory.forEach(function (device) {
if (device && device.name === deviceType.name.replace(/\-inch/g, ' inch') && device.isAvailable == true) {
availAcc.push(device);
}
});
return availAcc;
}, []);