HyperFormula 2.4.0: More public APIs and better test coverage

Jakub Wiśniewski HyperFormula / April 26, 2023

HyperFormula 2.4.0: More public APIs and better test coverage

We’ve just released HyperFormula 2.4.0. This version improves the capabilities of custom functions by exposing more public APIs, increases test coverage, and brings a few bug fixes.

More public APIs

HyperFormula offers a variety of APIs that let you quickly and precisely control the engine’s behavior according to your needs, from basic actions such as moving columns or adding named expressions, to features like operation batching or updating the configuration at runtime.

Version 2.4.0 extends the range of available features by exporting two more classes as public APIs: CellError and SimpleRangeValue.

Custom error messages

One of HyperFormula’s advantages is custom functions. If the already extensive list of nearly 400 built-in functions doesn’t match your needs, adding a custom function allows you to implement any logic you want.

Now, suppose the end user uses your custom function in a formula, but they make a mistake – you want to let them know what went wrong. That’s where the newly-exported CellError API comes in. It lets you:

  • Display the type of the error (e.g., #VALUE!)
  • Convey a user-friendly message
  • Point to the root of the problem

For more details on using the CellError API in custom functions, see HyperFormula’s documentation.

Custom functions can handle ranges

Your custom functions are not limited to processing individual cells: they can also accept and return whole ranges of cells at once. This significantly increases the number of potential use cases.

To handle ranges, you’ll need the other class exported in version 2.4.0: SimpleRangeValue. This API lets you:

  • Create ranges in different ways
  • Generate values and addresses of a range’s cells
  • Compare the size of two different ranges

For more details on handling ranges in custom functions, see HyperFormula’s documentation.

Better test coverage

In this version, thanks to the effort of a prolific community member (thank you, thilgen) HyperFormula increased its test coverage from 95.86% to 97.05%. Step by step, together we’re making it better.

Bug fixes

Removing a column works more consistently now: the removeColumns() method returns the same array of changes regardless of the address mapping policy used. Also, methods moveColumns() and setCellContents() can now operate on cells that contain null values, without causing any issues.

Release notes

What we added

What we fixed

  • Fixed a EmptyCellVertex data integrity issue between the AddressMapping and DependencyGraph objects. #1188
  • Fixed a build issue with M1- and M2-chip MacBooks. #1166
  • Fixed an issue where the order of items returned by removeColumns() depended on the address mapping policy. #1205