Javascript object comparison utility