Skip to content

1.0.0-beta.6 Dual package, new stat API, suggestions and error precision improvements, and more

Compare
Choose a tag to compare
@lahmatiy lahmatiy released this 18 Apr 18:07
  • Added support for custom methods as a string (jora query) in jora.setup()
  • Added a check for all methods are defined on query compilation step to avoid runtime exceptions
  • Allowed g, m, s and u flags in regexp literals
  • Improved error message when a methods is not defined, i.e. Method "foo" is not defined instead of m.foo is not a function
  • Improved error locations in string literals
  • Disallowed a backslash before closing quote or apostrophe in string literals
  • Fixed match() method to work well for RegExp with g flag and for strings when matchAll is true
  • Fixed sort() method to perform a stable sort for old js-engines and always place undefined values last
  • Fixed range in details for bad input errors
  • Fixed suggestion support in template literals (#33)
  • Fixed suggestions for = and != operators by avoiding unfold array values
  • Fixed suggestions for arrays in in, not in, has and has no operators to exclude literal values only
  • Removed value suggestions in cases | in <string or number> and <string or number> has |
  • Fixed a call stack overflow exception when too many (over ~110k) suggestion values for a range
  • BREAKING Reworked stat API:
    • Changed stat() method result value to return values as is, i.e. a Set instance instead of its materialization as an array. Mutations of sets (values and related) should be avoided since they are shared between all stat API methods calls.
    • Changed a signature of suggestion() method to get options as a second argument (optional), with the following options:
      • limit (default: Infinity) – a max number of the values that should be returned for each value type ("property", "value" or "variable")
      • sort (default: false) – a comparator function (should take 2 arguments and return a negative number, 0 or a positive number) for value list sorting, makes sence when limit is used
      • filter (default: function) – a filter function factory (pattern => value => <expr>) to discard values from the result when returns a falsy value (default is equivalent to patttern => value => String(value).toLowerCase().includes(pattern))
    • Changed suggestion() method result to return values grouped by a type:
          suggestion(): Array<{
              type: 'property' | 'value' | 'variable',
              from: number,
              to: number,
              text: string,
              suggestions: Array<string | number>
          }> | null
    • All the changes are targeted to improve performance and memory consumption when a query is performing to a huge datasets (hundreds of thousands of values). As a result a suggestions fetching is boosted up to 30-40 times for such cases.
  • Converted to Dual Package, i.e. ESM and CommonJS support
  • Changed Node.js support to ^10.12.0 || ^12.20.0 || ^14.13.0 || >=15.0.0
  • Changed dist modules:
    • Removed jora.min.js
    • Changed jora.js format from CJS to IIFE and applied minification
    • Added jora.esm.js (minified ESM module)
    • Added source maps jora.js.map & jora.esm.js.map