@vizhub/viz-utils
Version:
Utility functions for use across VizHub packages.
16 lines • 935 B
TypeScript
import { VizContent } from "@vizhub/viz-types";
/**
* Sets the text content of a file using an immutable update pattern.
* If a file with the given fileName exists, its text is updated while preserving its fileId.
* If no file with the given fileName exists, a new file is created with a generated fileId.
*
* @param content - The VizContent object to update (must not be null or undefined)
* @param fileName - The name of the file (must be a non-empty string)
* @param fileText - The new text content for the file (must be a non-empty string)
* @returns A new VizContent object with the updated or newly created file
* @throws Error if content is null or undefined
* @throws Error if fileName is empty or not a string
* @throws Error if fileText is empty or not a string
*/
export declare const setFileText: (content: VizContent, fileName: string, fileText: string) => VizContent;
//# sourceMappingURL=setFileText.d.ts.map