Function
src/core/functions/connectFunctions.ts:125connectFunctions
connectFunctions(names: readonly string[], source: NumericalFunctionSource): voidConnects numerical implementations from another library without replacing Nerdamer's
symbolic representation of those functions.
Existing parser functions keep their symbolic behavior. During numerical evaluation their
connected implementation is used when every argument is numeric. New names remain symbolic
during ordinary parsing and evaluate through the connected function only in evaluation mode.
The same numerical implementations are available to buildFunction.
This function is synchronous. It does not load packages or alter the caller's module system;
source is simply an already-loaded object. In an ESM application, a library such as mathjs
can therefore be loaded and used normally:
Parameters
| Name | Type | Description |
|---|---|---|
names | readonly string[] | Function names to connect from source, or '*' to connect every function. |
source | NumericalFunctionSource | Already-loaded object containing the numerical functions. |
Returns
void
Examples
import * as math from 'mathjs';
import { connectFunctions } from 'nerdamer/core';
connectFunctions(['zeta', 'combinations'], math);
```
Passing `'*'` connects every own enumerable function on `source`. Non-function properties are
skipped in wildcard mode. This is convenient for library-wide setup, but it can also expose
utility functions that are not meaningful as numerical Nerdamer functions.