Terminal Decorators

Decorators are utilities which allow to transform the text of the Terminal into a different text or a TAST.

The text is transformed even when the user is typing in the terminal.

Note: The output text or TAST must have the same length than the input text to be transformed.

registerDecorator

Registers a decorator which transforms the text of the Terminal into a different text or a TAST.

Copy
registerDecorator(decorator: { decorateText: (String) => String | Array }): void;
  • decorator Object

    Required. The decorator to be registered.

  • decorateText Function

    Required. A function which receives the text of each row and returns a TAST or a String of the transformed text.

registerDecorator - withFactory

Factories are allowed to register decorators using withFactory.

Copy
registerDecorator(decorator: { decorateText: withFactory(makeDecorator: DecoratorFunction) }): void;
  • decorator Object

    Required. The decorator to be registered.

  • decorateText Function

    Required A function which receives the text of each row and returns a TAST or a String of the transformed text.

  • makeDecorator Function

    Required Function to create the decorator.

  • withFactory Decorator

    Required Decorator to allow dependency injection.