Skip to content

Fixed issues where scopedData is null #72

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants