An easy way to do it is to query args length, and then return a promisified version like:
const util = require('util');
return util.promisify(User.get)(options);
@fishcharlie Mind to provide any explanations?
@diosney
Not filling out ALL of the relevant fields in this issue will cause your issue to be closed.util.promisify isn't required.I have the same issue, please @fishcharlie can you help us to find it in the your documentation, thanks so much.
@carmenates09 This is not an issue. As I stated above, if you don鈥檛 pass in a callback it will return a promise. Very simple.
@fishcharlie
1- OK, I will take that into account for the next issue, this seemed so easy for me to be explained that I thought filling the whole template was too much for two lines of explanation.
Nevertheless, it could be great if you educate us instead of trigger a defensive action by just closing it, since if I took the time to fill an issue at least is a sign that I want the project to be better.
2- Nice! It could be good if that is added to the documentation, since all examples have the callback pattern and there is no immediate clue that Promisified versions are available.
(all have it but populate, which is a special case and I thought that was only for it).
@diosney
1.
I totally understand. But there have also been a lot of issues created that are either already implemented, or don't provide enough detail. At the end of the day, having the requirement of filling out the issue template helps maintainers of the project. There is a chance, if you had to fill out the entire issue template, you would have looked a bit harder and researched the question a little bit more as opposed to filling out that whole issue template. I know although not the easiest to find, there is information online about using promises in Dynamoose. It is a delicate balance. This project has for sure moved towards less issues and support. Some GitHub projects have disabled issues altogether and relied solely on PRs to improve things. Which is something I'm truly considering exploring for this project. Hopefully that gives a bit more insight into why I have a firm stance on it. Only so many hours in a day and I consider my time to be one of the highest value assets I have. So although I don't mind helping others, I do expect you to first put in a considerable amount of time and effort on your own, which the issue template helps encourage you to do.
Put it simply, if you aren't even willing to read the first sentence of the issue template, why should I take anytime to read the issue at all?
Hopefully that gives a bit more clarity about why I have the stance I do on it.
2.
PRs are always welcome!! 馃槂
@fishcharlie OK, good to know.