  We design an operator from the infinite-dimensional Sobolev space
${\boldsymbol H}(\mathrm{curl})$ to its finite-dimensional subspace formed by
the N\'ed\'elec piecewise polynomials on a tetrahedral mesh that has the
following properties: 1) it is defined over the entire ${\boldsymbol
H}(\mathrm{curl})$, including boundary conditions imposed on a part of the
boundary; 2) it is defined locally in a neighborhood of each mesh element; 3)
it is based on simple piecewise polynomial projections; 4) it is stable in the
${\boldsymbol L}^2$-norm, up to data oscillation; 5) it has optimal
(local-best) approximation properties; 6) it satisfies the commuting property
with its sibling operator on ${\boldsymbol H}(\mathrm{div})$; 7) it is a
projector, i.e., it leaves intact objects that are already in the N\'ed\'elec
piecewise polynomial space. This operator can be used in various parts of
numerical analysis related to the ${\boldsymbol H}(\mathrm{curl})$ space. We in
particular employ it here to establish the two following results: i)
equivalence of global-best, tangential-trace-and curl-constrained, and
local-best, unconstrained approximations in ${\boldsymbol H}(\mathrm{curl})$
including data oscillation terms; and ii) fully $h$- and $p$- (mesh-size- and
polynomial-degree-) optimal approximation bounds valid under the minimal
Sobolev regularity only requested elementwise. As a result of independent
interest, we also prove a $p$-robust equivalence of curl-constrained and
unconstrained best-approximations on a single tetrahedron in the ${\boldsymbol
H}(\mathrm{curl})$-setting, including $hp$ data oscillation terms.
