UNPKG

rete-kit

Version:

Rete.js Kit ==== [![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua) [![Discord](https://img.shields.io/discord/1081223198055604244?color=%237289da&label=Discord)](https://disco

35 lines (34 loc) 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultiFileStrategy = void 0; /** * Strategy for keeping instructions as separate files */ class MultiFileStrategy { constructor(pathTransformerFactory, contentTransformerFactory) { this.pathTransformerFactory = pathTransformerFactory; this.contentTransformerFactory = contentTransformerFactory; } transform(instructions) { return instructions.map(instruction => { const pathTransformers = this.pathTransformerFactory ? this.pathTransformerFactory(instruction) : []; const contentTransformers = this.contentTransformerFactory ? this.contentTransformerFactory(instruction) : []; let file = instruction.file; let content = instruction.content; // Apply path transformers in sequence for (const transformer of pathTransformers) { file = transformer.transform(file); } // Apply content transformers in sequence for (const transformer of contentTransformers) { content = transformer.transform(content); } return { file, content, contextId: instruction.contextId, title: instruction.title }; }); } } exports.MultiFileStrategy = MultiFileStrategy;