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

Add recursion option to smartDereference #21

Open
mindblight opened this issue Apr 10, 2017 · 0 comments
Open

Add recursion option to smartDereference #21

mindblight opened this issue Apr 10, 2017 · 0 comments

Comments

@mindblight
Copy link
Owner

smartDereference won't attempt to dereference a dereferenced value. For example,

let store = {};

const jon = {
  id: 'user1',
  name: 'jon'
};
const jonReference = createReference('users', jon.id);
store = resolveReference(store, jonReference, jon);

const comment = {
  id: 'comment1',
  author: jonReference,
  comment: "something"
};
const commentReference = createReference('comments', comment.id);
store = resolveReference(store, commentReference, comment);

const blog = smartDereference(store, {
  title: "Some blog",
  comments: [commentReference]
});

// Should be jon, not jonReference
blog.comments[0].author === jonReference

User should be able to specify recursion depth. An infinite depth risks causing a stack overflow on a circular reference

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