(comments)
| 20 | // See info about semver ranges here: |
| 21 | // https://www.npmjs.com/package/semver |
| 22 | function buildGateVersionCondition(comments) { |
| 23 | if (!comments) { |
| 24 | return null; |
| 25 | } |
| 26 | |
| 27 | const resultingCondition = comments.reduce( |
| 28 | (accumulatedCondition, commentLine) => { |
| 29 | const commentStr = commentLine.value.trim(); |
| 30 | |
| 31 | if (!commentStr.startsWith(GATE_VERSION_STR)) { |
| 32 | return accumulatedCondition; |
| 33 | } |
| 34 | |
| 35 | const condition = commentStr.slice(GATE_VERSION_STR.length); |
| 36 | if (accumulatedCondition === null) { |
| 37 | return condition; |
| 38 | } |
| 39 | |
| 40 | return accumulatedCondition.concat(' ', condition); |
| 41 | }, |
| 42 | null |
| 43 | ); |
| 44 | |
| 45 | if (resultingCondition === null) { |
| 46 | return null; |
| 47 | } |
| 48 | |
| 49 | return t.stringLiteral(resultingCondition); |
| 50 | } |
| 51 | |
| 52 | return { |
| 53 | name: 'transform-react-version-pragma', |
no outgoing calls
no test coverage detected