| 123 | } |
| 124 | |
| 125 | export function getParams(entry) { |
| 126 | // Documentation.js seems to try to grab params from the function itself in |
| 127 | // the code if we don't document all the parameters. This messes with our |
| 128 | // manually-documented overloads. Instead of using the provided entry.params |
| 129 | // array, we'll instead only rely on manually included @param tags. |
| 130 | // |
| 131 | // However, the tags don't include a tree-structured description field, and |
| 132 | // instead convert it to a string. We want a slightly different conversion to |
| 133 | // string, so we match these params to the Documentation.js-provided `params` |
| 134 | // array and grab the description from those. |
| 135 | return (entry.tags || []) |
| 136 | |
| 137 | // Filter out the nested parameters (eg. options.extrude), |
| 138 | // to be treated as part of parent parameters (eg. options) |
| 139 | // and not separate entries |
| 140 | .filter(t => t.title === 'param' && !t.name.includes('.')) |
| 141 | .map(node => { |
| 142 | const param = (entry.params || []) |
| 143 | .find(param => param.name === node.name); |
| 144 | return { |
| 145 | ...node, |
| 146 | description: param?.description || { |
| 147 | type: 'html', |
| 148 | value: node.description |
| 149 | }, |
| 150 | properties: param?.properties // Preserve properties array for nested object parameters |
| 151 | }; |
| 152 | }); |
| 153 | } |