Refactors object properties iteration
Function prototype and "happy path" had some duplication.