Move conditional outside of map

Moving `invoke`'s isFunc conditional outside of the map function is a
minor optimization. Since isFunc never changes, the correct path can be determined before the map operation is done, saving a few cycles.