Skip to content

PromptScript API


Class: FormatterRegistry

Defined in: formatters/src/registry.ts:7

Registry for formatter implementations. Allows dynamic registration and discovery of formatters.

Constructors

Constructor

new FormatterRegistry(): FormatterRegistry

Returns

FormatterRegistry

Methods

clear()

static clear(): void

Defined in: formatters/src/registry.ts:67

Clear all registered formatters (useful for testing).

Returns

void


get()

static get(name): Formatter | undefined

Defined in: formatters/src/registry.ts:27

Get a formatter instance by name.

Parameters

name

string

Formatter identifier

Returns

Formatter | undefined

Formatter instance or undefined if not found


getAll()

static getAll(): Formatter[]

Defined in: formatters/src/registry.ts:36

Get all registered formatters.

Returns

Formatter[]

Array of formatter instances


has()

static has(name): boolean

Defined in: formatters/src/registry.ts:52

Check if a formatter is registered.

Parameters

name

string

Formatter identifier

Returns

boolean


list()

static list(): string[]

Defined in: formatters/src/registry.ts:44

List all registered formatter names.

Returns

string[]

Array of formatter identifiers


register()

static register(name, factory): void

Defined in: formatters/src/registry.ts:15

Register a formatter factory.

Parameters

name

string

Unique formatter identifier

factory

FormatterFactory

Factory function that creates formatter instances

Returns

void


unregister()

static unregister(name): boolean

Defined in: formatters/src/registry.ts:60

Unregister a formatter (useful for testing).

Parameters

name

string

Formatter identifier

Returns

boolean