(
data: FunctionDefSpec<NODETYPE, NAMES>,
)
| 167 | export const _mathmlGroupBuilders: Record<string, MathMLBuilder<any>> = {}; |
| 168 | |
| 169 | export default function defineFunction< |
| 170 | NODETYPE extends NodeType, |
| 171 | const NAMES extends readonly string[], |
| 172 | >( |
| 173 | data: FunctionDefSpec<NODETYPE, NAMES>, |
| 174 | ) { |
| 175 | const {type, names, htmlBuilder, mathmlBuilder} = data; |
| 176 | for (let i = 0; i < names.length; ++i) { |
| 177 | // To avoid destructuring and rebuilding an object, |
| 178 | // we store the entire FunctionDefSpec object, |
| 179 | // even though Parser only needs the FunctionSpec fields. |
| 180 | _functions[names[i]] = data; |
| 181 | } |
| 182 | if (type) { |
| 183 | if (htmlBuilder) { |
| 184 | _htmlGroupBuilders[type] = htmlBuilder; |
| 185 | } |
| 186 | if (mathmlBuilder) { |
| 187 | _mathmlGroupBuilders[type] = mathmlBuilder; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Use this to register only the HTML and MathML builders for a function (e.g. |
no outgoing calls
no test coverage detected
searching dependent graphs…