handsontable / handsontable/hyperformula
Named Expressions doesn't have static methods
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Description
From working on Custom Functions #317 looks like it's useful to have functions and languages registered globally (static) and locally (instance) so we can have both, shared registry and customized for each instance.
For Named Expression the use case may even be more common. We want to have expressions that are part of our application, i.e. TRUE / FALSE #5, and initialize an instance with the expressions that are part of the particular workbook.
Note:
It is possible to have a global variable with named expressions and registering them for each instance
const SharedNamedExpressions = [A, B, C, D]
const engine_1 = HyperFormula.buildEmpty({
namedExpressions: [...SharedNamedExpressions, F, G, H]
})
SharedNamedExpressions.forEach((expression) => {
engine_1.addNamedExpression(expression)
})
const engine_2 = HyperFormula.buildEmpty({
namedExpressions: [...SharedNamedExpressions, X, Y, Z]
})
SharedNamedExpressions.forEach((expression) => {
engine_2.addNamedExpression(expression)
})
Or, with #319:
const SharedNamedExpressions = [A, B, C, D]
const engine_1 = HyperFormula.buildEmpty({
namedExpressions: [...SharedNamedExpressions, F, G, H]
})
const engine_2 = HyperFormula.buildEmpty({
namedExpressions: [...SharedNamedExpressions, X, Y, Z]
})
But it would be a lot more elegant way to do it once
HyperFormula.addNamedExpression( [A, B, C, D] )
const engine_1 = HyperFormula.buildEmpty()
const engine_2 = HyperFormula.buildEmpty()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Named Expression registration path and the HyperFormula.buildEmpty configuration handling. Compare how instance-level expressions are stored and initialized, then define and verify the shared static registration behavior for newly built engines without losing per-instance expressions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100