Converts the specified object to an enumeration according to the following rules: Tip:

You may call this function in a more method-like style:

obj.toEnum()