Detect if bluebird is used instead of native Promises
See original GitHub issueIs there a way to automatically verify that my code uses bluebird promises instead of native ones? In other words I would like every file that uses Promise
object to be checked if there is a var Promsie = require('bluebird');
in the beginning of the file.
If there is no such tool I will happily write one, when I have time that is:).
Edit I’m using Node v4 with ES6 and the way I’m using promises is polyfilling/replacing original Promise object with Bluebird one. It’s the same approach that Bluebird promotes in their documentation here.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12
Top Results From Across the Web
Native promises vs. Bluebird promises - node.js - Stack Overflow
Like with many things in Javascript, you should probably just test to see if the features you want to use are present rather...
Read more >Using Bluebird Promises - Mastering JS
Bluebird is a popular promises library for JavaScript. It is a drop-in replacement for native Promises in JavaScript. global.
Read more >Bluebird vs Native vs Async/Await - 2020 State of Javascript ...
Use Bluebird for parallel execution of promises. In general: Bluebird retains the smallest memory footprint in all cases; Promise performances ...
Read more >Features - Bluebird JS
Synchronous inspection allows you to retrieve the fulfillment value of an already fulfilled promise or the rejection reason of an already rejected promise...
Read more >Native vs 3rd Party Promise Implementations - Bambielli's Blog
It points to a perf test that shows Bluebird promises are around 4x faster and use 4x less memory than native ES6 promises...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think most people just use bluebird to replace the global
Promise
object and call it a day.@benjamingr so please modify Bluebird documentation. Currently Bluebird is encouraging usage of
var Promise = require('bluebird');
which is a trap. By trap I mean situation whenever somebody forgets to import blurbird and by mistake original Promise object is used and application either breaks (easy to fix) or there are silent errors (impossible to fix, because you don’t even know that there is an error somewhere). As you may know original Promises don’t print errors that are thrown from within promise chain.One of the reasons I use bluebird is that it prints uncaught errors to the console.