It very much depends. If you are implementing for speed, you may want to consider leavin the choice of validation to the user. If you are implementing for stability, you may want to validate as part of the function.
Imagine an array and the push() function validates. Now imagine using that function a a few hundred times per frame at 60 FPS in a game. That's an extra >6000 if calls per second. Thats a big enough number to matter.