We address the question of the electromagneticdensity and the mass function for regular rotating electrically charged compact objects as determined by dynamical equations of nonlinear electrodynamics minimally coupled to gravity. The rotating electrically charged compact objects are described by axially symmetric geometry, in which their electromagnetic fields are governed by four source-free equations for two independent field components of the electromagnetic tensor Fμν, with two constraints on the integration functions. An additional condition of compatibility of four dynamical equations for two independent field functions imposes the constraint on the Lagrange derivative LF=dL/dF, directly related to the electromagnetic density. As a result, the compatibility condition determines uniquely the generic form of the electromagnetic density and the mass function for regular rotating electrically charged compact objects.