Skip to content
Myr

input.js

This file

Path

lib/stdio/input.js

21 lines · 561 bytes · JavaScript

Last changed by

Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25

History of this file

Take it

Refactor `stdio` options (#623)ehmickybefore adoption2d76897

lines 1–2why, one step back
1import {isStream as isNodeStream} from 'is-stream';
2

Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25

lines 3–7why, one step back
3// Append the `stdin` option with the `input` and `inputFile` options
4export const handleInputOptions = ({input, inputFile}) => [5 handleInputOption(input),6 handleInputFileOption(inputFile),7].filter(Boolean);

Refactor `stdio` options (#623)ehmickybefore adoption2d76897

line 8why, one step back
8

Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25

lines 9–13why, one step back
9const handleInputOption = input => input && {
10 type: isNodeStream(input) ? 'nodeStream' : 'stringOrBuffer',11 value: input,12 optionName: 'input',13 index: 0,

Refactor `stdio` options (#623)ehmickybefore adoption2d76897

lines 14–15why, one step back
14};
15

Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25

lines 16–20why, one step back
16const handleInputFileOption = inputFile => inputFile && {
17 type: 'filePath',18 value: inputFile,19 optionName: 'inputFile',20 index: 0,

Refactor `stdio` options (#623)ehmickybefore adoption2d76897

line 21why, one step back
21};