sort javascript objects so that their properties iterate in a known order