map function for objects (instead of arrays)