(_ref)
| 6197 | |
| 6198 | var _mathmlGroupBuilders = {}; |
| 6199 | function defineFunction(_ref) { |
| 6200 | var type = _ref.type, |
| 6201 | nodeType = _ref.nodeType, |
| 6202 | names = _ref.names, |
| 6203 | props = _ref.props, |
| 6204 | handler = _ref.handler, |
| 6205 | htmlBuilder = _ref.htmlBuilder, |
| 6206 | mathmlBuilder = _ref.mathmlBuilder; |
| 6207 | // Set default values of functions |
| 6208 | var data = { |
| 6209 | type: type, |
| 6210 | numArgs: props.numArgs, |
| 6211 | argTypes: props.argTypes, |
| 6212 | greediness: props.greediness === undefined ? 1 : props.greediness, |
| 6213 | allowedInText: !!props.allowedInText, |
| 6214 | allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, |
| 6215 | numOptionalArgs: props.numOptionalArgs || 0, |
| 6216 | infix: !!props.infix, |
| 6217 | consumeMode: props.consumeMode, |
| 6218 | handler: handler |
| 6219 | }; |
| 6220 | |
| 6221 | for (var i = 0; i < names.length; ++i) { |
| 6222 | // TODO: The value type of _functions should be a type union of all |
| 6223 | // possible `FunctionSpec<>` possibilities instead of `FunctionSpec<*>`, |
| 6224 | // which is an existential type. |
| 6225 | // $FlowFixMe |
| 6226 | _functions[names[i]] = data; |
| 6227 | } |
| 6228 | |
| 6229 | if (type) { |
| 6230 | if (htmlBuilder) { |
| 6231 | _htmlGroupBuilders[type] = htmlBuilder; |
| 6232 | } |
| 6233 | |
| 6234 | if (mathmlBuilder) { |
| 6235 | _mathmlGroupBuilders[type] = mathmlBuilder; |
| 6236 | } |
| 6237 | } |
| 6238 | } |
| 6239 | /** |
| 6240 | * Use this to register only the HTML and MathML builders for a function (e.g. |
| 6241 | * if the function's ParseNode is generated in Parser.js rather than via a |
no outgoing calls
no test coverage detected