Clean objects in javascript,deleting undefined and null properties