(path, state)
| 67 | name: 'transform-fast-rest', |
| 68 | visitor: { |
| 69 | Program(path, state) { |
| 70 | const childState = new Map(); |
| 71 | const useHelper = state.opts.helper === true; // defaults to false |
| 72 | |
| 73 | if (!useHelper) { |
| 74 | let inlineHelper; |
| 75 | if (state.opts.literal === false) { |
| 76 | inlineHelper = template.expression.ast`Array.prototype.slice`; |
| 77 | } else { |
| 78 | inlineHelper = template.expression.ast`[].slice`; |
| 79 | } |
| 80 | childState.set('slice', inlineHelper); |
| 81 | } |
| 82 | |
| 83 | path.traverse(VISITOR, childState); |
| 84 | |
| 85 | const name = childState.get('slice'); |
| 86 | if (name && useHelper) { |
| 87 | const helper = slice({ IDENT: name }); |
| 88 | t.addComment(helper.declarations[0].init, 'leading', '#__PURE__'); |
| 89 | path.unshiftContainer('body', helper); |
| 90 | } |
| 91 | }, |
| 92 | }, |
| 93 | }; |
| 94 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…