Skip to content
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

Retrieve a raw list as values without having to use for await #24

Open
jaxoncreed opened this issue May 1, 2019 · 2 comments
Open

Retrieve a raw list as values without having to use for await #24

jaxoncreed opened this issue May 1, 2019 · 2 comments
Labels
feature A new feature to be added

Comments

@jaxoncreed
Copy link

This might already exist, but I didn't see it documented and I was not able to find it while doing a brief amount of code exploration.

Essentially, I'd like to be able to get all values fetched as an array without using for await.... This way I can perform fetches for subsequent values in parallel.

    const friends = [];
    const ldFriends = (await data.user.friends).listValue; // <-- List value does not exist currently. Right now, calling value will return only one of the values retreived
    console.log(ldFriends);
    await Promise.all(ldFriends.map(async ldFriend => {
      console.log(ldFriend.value)
      try {
        friends.push({
          name: (await data[ldFriend.value].vcard_fn).value,
          webId: ldFriend.value
        })
      } catch(err) {}
    }))
    this.setState({ friends });
@jaxoncreed jaxoncreed added the feature A new feature to be added label May 1, 2019
@RubenVerborgh
Copy link
Member

suggestion: .all?

@jaxoncreed
Copy link
Author

Yeah. .all sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature to be added
Projects
None yet
Development

No branches or pull requests

2 participants