Is there a way in Node.js to check to determine if global.Promise
is the native promise implementation? As opposed to Bluebird promises, etc?
You could do a feature test and test to see if any of the Bluebird extended features are present:
function testBluebird() {
// test to see if a representative sample of Bluebird-specific features are present
return Promise && Promise.join && Promise.try && Promise.method && Promise.map;
}
Like with many things in Javascript, you should probably just test to see if the features you want to use are present rather than trying to determine if a specific library is loaded.