(stdioItems, direction)
| 30 | |
| 31 | // Retrieve the `objectMode` of a file descriptor, e.g. `stdout` or `stderr` |
| 32 | export const getFdObjectMode = (stdioItems, direction) => { |
| 33 | const lastTransform = stdioItems.findLast(({type}) => TRANSFORM_TYPES.has(type)); |
| 34 | if (lastTransform === undefined) { |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | return direction === 'input' |
| 39 | ? lastTransform.value.writableObjectMode |
| 40 | : lastTransform.value.readableObjectMode; |
| 41 | }; |