@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
49 lines • 1.26 kB
JavaScript
import { Node } from "../../../NodeSystem/Node.js";
import { Instruction } from "../Instruction.js";
/**
* Represents an instruction which provides nodes.
*
* @template TItem
* The type of the nodes.
*
* @template TOptions
* The type of the options for generating nodes.
*/
export class NodeSystemInstruction extends Instruction {
/**
* Initializes a new instance of the {@link NodeSystemInstruction `NodeSystemInstruction<TItem, TOptions>`} class.
*
* @param options
* The options for generating the object.
*
* @param generator
* The generator-function for generating sub-nodes.
*/
constructor(options, generator) {
super(options);
/**
* The nodes provides by the instruction.
*/
this.nodes = [];
for (let node of options.Nodes) {
this.nodes.push(new Node(node, generator));
}
}
/**
* @inheritdoc
*/
get Nodes() {
return this.nodes;
}
/**
* @inheritdoc
*/
get ObjectsByID() {
let result = {};
for (let node of this.Nodes) {
Object.assign(result, node.GetObjects());
}
return result;
}
}
//# sourceMappingURL=NodeSystemInstruction.js.map