UNPKG

prompt-compose

Version:

A JS library for building and managing GPT prompts documents.

18 lines (14 loc) 480 B
import { PromptIO } from "../base-components/components.interface"; import { Statement, None } from "../base-components"; import { getConfig } from "../config" const Tabs = (prompt: PromptIO)=>(input: PromptIO = None())=>{ const config = getConfig(); const TAB_TEXT = config.tabType.repeat(config.tabRepeat); let text = Statement(prompt)(input); text = TAB_TEXT + text; text = text.replaceAll("\n", `\n${TAB_TEXT}`); return text; } export { Tabs };