parseInstructionPlanInput

function parseInstructionPlanInput(input): InstructionPlan;

Parses an InstructionPlanInput and returns an InstructionPlan.

This function handles the following input types:

Parameters

ParameterTypeDescription
inputInstructionPlanInputThe input to parse into an instruction plan.

Returns

InstructionPlan

The parsed instruction plan.

Examples

Parsing a single instruction.

const plan = parseInstructionPlanInput(myInstruction);
// Equivalent to: singleInstructionPlan(myInstruction)

Parsing an array of instructions.

const plan = parseInstructionPlanInput([instructionA, instructionB]);
// Equivalent to: sequentialInstructionPlan([instructionA, instructionB])

Parsing a mixed array with nested plans.

const plan = parseInstructionPlanInput([
  instructionA,
  parallelInstructionPlan([instructionB, instructionC]),
]);
// Returns a sequential plan containing:
// - A single instruction plan for instructionA.
// - The parallel plan for instructionB and instructionC.

Single-element arrays are unwrapped.

const plan = parseInstructionPlanInput([myInstruction]);
// Equivalent to: singleInstructionPlan(myInstruction)

See

On this page