The options argument of a spawner call, or undefined when none is passed.
(call: ts.CallExpression, spawner: string)
| 115 | |
| 116 | /** The options argument of a spawner call, or undefined when none is passed. */ |
| 117 | function optionsArg(call: ts.CallExpression, spawner: string): ts.Expression | undefined { |
| 118 | const [, second, third] = call.arguments; |
| 119 | if (SPAWNERS[spawner] === 'command') return second; |
| 120 | // (file, options) is allowed when the args array is omitted: an object there |
| 121 | // is the options, literal or not (`execFileSync('git', opts)`). |
| 122 | if (call.arguments.length === 2 || (second && ts.isObjectLiteralExpression(second))) return second; |
| 123 | return third; |
| 124 | } |
| 125 | |
| 126 | function unwrap(expr: ts.Expression): ts.Expression { |
| 127 | let e = expr; |