[javascript] Fast way to get the min/max values among properties of object