handsontable / handsontable/hyperformula
Call `runFunction` internally so it's easier to create custom functions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Description
Currently each function calls runFunction with a callback. It does a lot of useful things and reduces the boilerplate (ie. argument validation) so it's natural that most implementations will want to use it. Also having meta properties for each functions kind of feels that validations is always done by the engine.
Would become a simple
public mod(ast: ProcedureAst, formulaAddress: SimpleCellAddress, args: ModArgs): InternalScalarValue {
const { dividend, divisor } = args
if (divisor === 0) {
return new CellError(ErrorType.DIV_BY_ZERO)
}
return dividend % divisor
}
Interpreter already have access to AST, function meta and other properties, no need to create all this boilerplate code.
Other thoughts
- We may have a flag to make the internal validation optional if someone want so implement everything on their own.
- We should keep
astandformulaAddress, may be useful
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 with the linked src/interpreter/plugin/ModuloPlugin.ts example and trace how its callback reaches runFunction, including the current argument validation and function metadata handling. Compare that flow with the proposed mod implementation; done should leave a defined internal invocation model that preserves the useful context and supports custom functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100