Skip to content

negative index on empty arrays gives index out of bound instead of giving null output. #77

Description

@siddhantrawat

jsonata: [][-1]
js output: ** no match **
java output: Index -1 out of bounds for length 0

jsonata: [][1]
js output: ** no match **
java output: null


input json:{"item": []}

jsonata: item[-1]
js output: ** no match **
java output:Index -1 out of bounds for length 0

jsonata: item[-2]
js output: ** no match **
java output:Index -2 out of bounds for length 0

jsonata: item[0]
js output: ** no match **
java output:null

jsonata: item[1]
js output: ** no match **
java output:null

positive indexes looks good. but on accessing negative indexes, instead of resulting in null, exception IndexOutOfBound is thrown.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions