In this issue comment you suggested an only function to validating cpf or cnpj. May be a great idea to validate if the field is according to some document format.
This make sense when you need save contacts with some document is present but not both at the same time.