Use selectType to query selection mode. You must use -ocm flag to query per-object mode.
For example to check if component mode on currently selected object is vertex:
selectType -ocm -q -v
It will return boolean value.
Take a look at the selectType documentation to see what modes you can query.