Skip to content

1.0.0-beta.1

Choose a tag to compare

@lahmatiy lahmatiy released this 14 May 13:11
· 408 commits to master since this release
  • Added [...expr] syntax
  • Added $$ root reference (arg1), which refers to second parameter of closest function or undefined when no such
  • Added reduce() method
  • Added support for methods as a reference to definition's value, i.e. $method: => 123; $method() or path.$method()
  • Added walk() method to traverse AST
  • Allowed numbers without integer part, i.e. .123 or .5e-4
  • Allowed numbers and literals as property name in object literals, i.e. { 1: 'ok', null: 'ok' }
  • Changed = and != operators to use Object.is() instead of === and !== operators
  • Changed behaviour for references to undefined definitions, now an exception raises in default mode, but no exceptions in tolerant mode
  • Changed array-like access notation (i.e. foo[expr]) to behave like pick() method
  • Reworked pick() method:
    • Return first entry value when no argument gived
    • String values are treat as an array
    • Added support for negative indicies for array and strings
    • Return a value for object and function as reference, instead of entry
    • Pass index or key to function reference as second parameter (can be accessed by $$)
    • When no arguments given or reference is undefined for object, return first entry value instead of value with key undefined
    • Cast boolean values to a number index when access to an array or string, i.e. false -> 0 and true -> 1
  • Improved tolerant mode to not fail on methods that doesn't exists, such invocations silently returns undefined
  • Improved parse and some compile errors
  • Fixed suggestion in empty function body for new syntax, i.e. group(=>) will suggest between => and )
  • Fixed ~= operator to produce a boolean result only
  • Removed mapToArray() method, use entries().({ nameProp: key, ...value }) instead
  • Grand internal refactoring around AST processing:
    • Parser generates less virtual nodes, so parse->stringify is much closer to original code (white spaces and comments mostly lost)
    • Suggestion subsystem moved aside from parser to a separate module which uses in stat mode only
    • Various fixes and improvements in suggestions
    • The new approach allows to implement more complex suggestion scenarios like suggestions in array values for operators in, not in, has and has no which was added (e.g. in query ["a", "b", 1, 2][$ in ["b", 2]] jora will suggest only "a" and 1 values in array after in operator)