-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question (not issue) #83
Comments
This isn't so much an issue with my library, but more a javascript question. What you pass to thingy.then(function(value) {
const arr = value;
console.log(arr);
return arr;
}); When rewritten like this, it becomes clear that the In addition, what's important to understand is that Now, if you want to pass along the results of
We can make async function getInfoByName(title) {
const arr = await cli.get({ 'name': title });
return arr;
} Now, What that means in practice, is
You don't have to use the fancy function getInfoByName(title) {
return cli.get({'name': title});
} Here, you're just forwarding along the Finally, the most important part of this, is that 1 & 2 are the same option. Let's look at this trivial jsfiddle: https://jsfiddle.net/cd7x6kvh/ If you look at the js console after running it, you can see that even though we told our function Let me know if that helped or if you have other questions! |
@worr I found this library today and just wanted to say you taking your time and carefully explaining The async concept to this dude is the most wholesome thing I've seen on github. Big ups to you man! |
It logs properly but returns
undefined
. I don't understand why it waits to resolve the promise forconsole.log
but not forreturn
, sorry for the unnecessary issue but I'm desperate.The text was updated successfully, but these errors were encountered: