Skip to content

Conversation

@ivan133
Copy link

@ivan133 ivan133 commented Sep 26, 2019

In rule like this

{"all" : [   {
  var: 'current_value'
}, {
  in: [
    {
      "var":""
    },
    [
      0,
      'A',
      'B',
      'C',
      ' '
    ]
  ]
} ]}

If current_value is undefined (null) I'll get error Cannot read property 'length' of null

Pass ROOT_DATA to map operation
I've created a new jsonlogic operation mapWithScope based on map operation
Rolled back map operation
Also added here CURRENT_LOOP_INDEX to get current loop index started from 0
@josephdpurcell
Copy link

Using the latest version I ran this:

jsonLogic.apply(
    {"all" : [   {
      var: 'current_value'
    }, {
      in: [
        {
          "var":""
        },
        [
          0,
          'A',
          'B',
          'C',
          ' '
        ]
      ]
    } ]}
);

And it did not throw an error.

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

Successfully merging this pull request may close these issues.

2 participants