MCPcopy Create free account
hub / github.com/sindresorhus/execa / getTransforms

Function getTransforms

lib/transform/normalize.js:13–29  ·  view source on GitHub ↗
(stdioItems, optionName, direction, {encoding})

Source from the content-addressed store, hash-verified

11];
12
13const getTransforms = (stdioItems, optionName, direction, {encoding}) => {
14 const transforms = stdioItems.filter(({type}) => TRANSFORM_TYPES.has(type));
15 const newTransforms = Array.from({length: transforms.length});
16
17 for (const [index, stdioItem] of Object.entries(transforms)) {
18 newTransforms[index] = normalizeTransform({
19 stdioItem,
20 index: Number(index),
21 newTransforms,
22 optionName,
23 direction,
24 encoding,
25 });
26 }
27
28 return sortTransforms(newTransforms, direction);
29};
30
31const normalizeTransform = ({stdioItem, stdioItem: {type}, index, newTransforms, optionName, direction, encoding}) => {
32 if (type === 'duplex') {

Callers 1

normalizeTransformsFunction · 0.85

Calls 2

normalizeTransformFunction · 0.85
sortTransformsFunction · 0.85

Tested by

no test coverage detected