Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 19, 2019
1 parent d51ca80 commit f2a3556
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/stdio.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';
const aliases = ['stdin', 'stdout', 'stderr'];
const alias = ['stdin', 'stdout', 'stderr'];

const hasAlias = opts => aliases.some(alias => opts[alias] !== undefined);
const hasAlias = opts => alias.some(alias => opts[alias] !== undefined);

const stdio = opts => {
if (!opts) {
return;
}

if (opts.stdio && hasAlias(opts)) {
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${alias.map(alias => `\`${alias}\``).join(', ')}`);
}

if (typeof opts.stdio === 'string') {
Expand All @@ -23,15 +23,15 @@ const stdio = opts => {
}

const result = [];
const len = Math.max(stdio.length, aliases.length);
const len = Math.max(stdio.length, alias.length);

for (let i = 0; i < len; i++) {
let value;

if (stdio[i] !== undefined) {
value = stdio[i];
} else if (opts[aliases[i]] !== undefined) {
value = opts[aliases[i]];
} else if (opts[alias[i]] !== undefined) {
value = opts[alias[i]];
}

result[i] = value;
Expand Down

0 comments on commit f2a3556

Please sign in to comment.