json-logic-js icon indicating copy to clipboard operation
json-logic-js copied to clipboard

Fixed issues where scopedData is null

Open ivan133 opened this issue 4 years ago • 1 comments

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

ivan133 avatar Sep 26 '19 07:09 ivan133

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.

josephdpurcell avatar Jan 22 '23 01:01 josephdpurcell