Skip to content

Support for traversing upwards in an element in a tree #208

Open
@kylef

Description

@kylef

For example, given I have a reference element, I should be able dereference it.

Given the following tree called, structures

const element = {
  element: 'array',
  content: [
    {
      element: 'dataStructure',
      meta: {
        id: {
          element: 'string',
          content: 'User',
        }
      },
      content: {
        element: 'object',
        content: [
          {
            element: 'member',
            content: {
              key: {
                element: 'string',
                content: 'last_comment'
              },
              value: {
                element: 'ref',
                content: 'Comment'
              }
            }
          }
        ]
      }
    },
    {
      element: 'dataStructure',
      meta: {
        id: {
          element: 'string',
          content: 'Comment',
        }
      }
    }
  ]
};

Given I have a reference to the User dataStructure as user:

const last_comment = user.get('last_comment');
last_comment.dereference();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions