How do I detect running in emulator vs real device?

As a matter of fact, I did not even figure out how to do this with just Cordova.
I found this http://stackoverflow.com/questions/20761520/phonegap-detect-emulation but does not seems to work anymore. device.platform gives me iOS device.model gives me x86_64
I filed a JIRA to Cordova https://issues.apache.org/jira/browse/CB-8767 but I wonder if anyone here knows anything.

Thank you!

Hmm, good question. Just did a quick test, and it seems that emulator returns model: "x86_64" when getting the model
http://ngcordova.com/docs/plugins/device/