Skip to content

Add recursion option to smartDereference #21

Description

@mindblight

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions