Is there a simple and elegant way to determinate if variable is promise or object in javascript (es6)?
I have a variable
let payment;
and at one time in app, it can be either promise or object with real values. I know I can test it it contains some properties like
if (payment.amount)
but this doesn't seems like an elegant solution to me, because properties (data structure) can change in time. Till now I was using
if (typeof payment === 'object')
but I've just figured out, that promises are basically also objects. So this condition is always true.
Is it possible to tell if it's a promise or object with real data?