How do I check if the app is running in PhoneGap (or as native app) vs Mobile web browser (i.e. Safari)?

For example in this pseudocode

Code:
if (runningNatively) {
    enable camera-related UI
} else {
    disable camera-related UI
}

The reason I am asking is because I have a ST web app working and it's in production. I used the same code to build a sample iPhone app, but now I need to add native device functions, such as camera and push notification.

I am debating whether I should use the same code base (modify one copy), but add checks at certain points in the app to integrate native phone functions, or should I make a copy, and maintain two separate code bases (Web app vs Native app).

[EDIT] I guess I could always hardcode a global constant in index.html, then I maintain two index.html but one app.js. Still I'd like to know what others think.