Skip to content

Access prior parsed values in Array formatter #30

Description

@dsshap

I have this example:

var payload = Parser.start()
        .uint8('data_type')
        .uint8('data_length')
        .array('data', {
          type: 'uint8',
          length: 'data_length',
          formatter: function(array){
            // ACCESS 'data_type' HERE!!
            return array
          }
        })

I want to be able to access data_type inside formatter of array.

I inspected this, but it wasn't clear how to get to this value.
The scope is available in `length'.

Is this possible? If yes, how?

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