benmarch / spel2js

Parse Spring Expression Language in JavaScript
Other
69 stars 19 forks source link

Fixed compiling of constructor and type reference. Fixed unary plus/minus. Added node.getRaw(). #14

Closed ukrbublik closed 2 years ago

ukrbublik commented 2 years ago
  1. Fixed error Cannot read property 'setParent' of undefined when trying to compile expression with constructor or type reference
new java.text.SimpleDateFormat("yyyy-MM-dd").parse("2022-01-01")
T(java.time.LocalTime).parse("11:22")
  1. Added support for array constructors

    new int[]{1, 2, 3}
    new int[3]{1, 2, 3}
  2. Fixed urary plus/minus. Resolves issue https://github.com/benmarch/spel2js/issues/12

  3. Added node.getRaw() for some types to get raw value (eg. propertyName for property node). Can be used for debugging compiled expressions. Used in https://github.com/ukrbublik/react-awesome-query-builder to convert compiled expression to internal store format.

Added unit tests

benmarch commented 2 years ago

Thanks, @ukrbublik, looks good to me. I'll publish a new version with these changes shortly.

ukrbublik commented 2 years ago

Thanks @benmarch 👍