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

provide internal function to "normalize" "data" result #621

Open
aprilmintacpineda opened this issue Feb 27, 2022 · 0 comments
Open

provide internal function to "normalize" "data" result #621

aprilmintacpineda opened this issue Feb 27, 2022 · 0 comments

Comments

@aprilmintacpineda
Copy link

See an example of an existing similar functionality: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_util_dynamodb.html#unmarshall-1

When we fetch a record from fauna, we get things like Ref, which we obviously have to manually "normalize" before returning the data to the frontend, like so:

return {
  statusCode: 200,
  body: {
    data: posts.data.map(item => {
      return {
        ...item.data,
        id: item.ref.id
      };
    })
  }
};

ideally, fauna-js should have a built-in function to normalize deeply nested such data.

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

No branches or pull requests

1 participant