({type, value, direction, optionName})
| 27 | // The explicitly requested `direction` must not contradict a value that is intrinsically the other direction. |
| 28 | // For example, `{value: writableStream, input: true}` is invalid since a writable value can only be an output. |
| 29 | const getRequestedDirection = ({type, value, direction, optionName}) => { |
| 30 | const guessedDirection = guessStreamDirection[type](value); |
| 31 | if (direction === 'input' && guessedDirection === 'output') { |
| 32 | throw new TypeError(`The \`${optionName}\` option is invalid: \`input: true\` cannot be used with a writable value, which is always an output.`); |
| 33 | } |
| 34 | |
| 35 | return direction ?? guessedDirection; |
| 36 | }; |
| 37 | |
| 38 | // `stdin`/`stdout`/`stderr` have a known direction |
| 39 | const KNOWN_DIRECTIONS = ['input', 'output', 'output']; |
no outgoing calls
no test coverage detected