I'm working with a library which defines the following interfaces:
LocalUser {
data {
value: LocalDataValue
},
...various other methods etc...
}
RemoteUser {
data {
value: RemoteDataValue
},
...various other methods etc...
}
Then it gives me a User which is defined like this (I can work out which type of user it is based on how it was obtained, but there doesn't seem to be a way to actually pass that information on):
User {
value: LocalUser|RemoteUser
}
because for the vast majority of my code it doesn't matter. However, at one point I need to know whether I'm dealing with a LocalUser, because I only want to do a particular operation on LocalUsers. Is there a way to know whether a LocalUser is a RemoteUser or a LocalUser?
I can't find anywhere in the documentation which tells me what the difference is between them, though I know that some methods only appear on LocalUser and not on RemoteUser (eg I can do localUser.enable() but remoteUser.enable() doesn't work).
Is there a way to do something like this:
if(myUnknownUser isInstanceOf (LocalUser)) { doSomething() }
or a better way to handle this?