* @param {{ * text: string, * expression?: Node, * type?: string, * rootMarker?: string, * comments?: Comment[], * }} options
(options)
| 12 | * }} options |
| 13 | */ |
| 14 | function wrapExpression(options) { |
| 15 | const { |
| 16 | type = "JsExpressionRoot", |
| 17 | expression, |
| 18 | comments = expression?.comments ?? [], |
| 19 | text, |
| 20 | rootMarker, |
| 21 | } = options; |
| 22 | |
| 23 | const root = { |
| 24 | type, |
| 25 | comments, |
| 26 | range: [0, text.length], |
| 27 | rootMarker, |
| 28 | }; |
| 29 | |
| 30 | if (expression) { |
| 31 | delete expression.comments; |
| 32 | root.node = expression; |
| 33 | } |
| 34 | |
| 35 | return root; |
| 36 | } |
| 37 | |
| 38 | export default wrapExpression; |
no outgoing calls
no test coverage detected