Describer

Hierarchy

  • Describer

Implements

Index

Constructors

Methods

Object literals

Constructors

constructor

+ new Describer(describers?: Map‹string, TypeDescriber›): Describer

Creates an instance of Describer. Creates an instance of Describer.

Parameters:

NameType
describers?Map‹string, TypeDescriber

Returns: Describer

Methods

createDescription

createDescription(value: any | any[]): Stringifiable

Describes individual value or list of values(as an array).

Parameters:

NameTypeDescription
valueany | any[]Any value or list of values.

Returns: Stringifiable

Instance of Description for single value or DescriptionList instance as list of values.


describe

describe(value: any | any[]): string

Describes value or list of values as human readable string.

Parameters:

NameTypeDescription
valueany | any[]Any value or list of values.

Returns: string

String description of provided value(s).


getDescriber

getDescriber(type: string): TypeDescriber | undefined

Returns describer by mapping.

Parameters:

NameTypeDescription
typestringMapping type for describer.

Returns: TypeDescriber | undefined

Registered describer instance, else undefined.


getDescribers

getDescribers(): Map‹string, TypeDescriber

Returns all registered describers.

Returns: Map‹string, TypeDescriber

Registered describers mappings.


hasDescriber

hasDescriber(type: string): boolean

Evaluates if describer is already registered by mapping id.

Parameters:

NameTypeDescription
typestringMapping type for describer.

Returns: boolean

Returns true if describer is registered, else false.


overrideDescriber

overrideDescriber(type: string, describer: TypeDescriber): void

Overrides already existing describer by mapping on describer.

Parameters:

NameTypeDescription
typestringType for which mapping will be created or overridden.
describerTypeDescriberDescriber for registration.

Returns: void


registerDescriber

registerDescriber(type: string, describer: TypeDescriber, shouldOverride?: boolean): void

Registers describer on describer.

throws {TypeDescriberExistsError} Thrown if mapping would overridden on describer without explicit call.

Parameters:

NameTypeDescription
typestringType for which mapping will be created.
describerTypeDescriberDescriber for registration.
shouldOverride?booleanFlag indicating that mapping should be overridden if exist.

Returns: void


removeDescriber

removeDescriber(type: string): void

Removes describer by mapping id.

Parameters:

NameTypeDescription
typestringMapping type for describer.

Returns: void


setFormatting

setFormatting(formatting: DescriberFormatting): void

Implementation of Describer

Describer initializer.

Parameters:

NameTypeDescription
formattingDescriberFormattingFormatting for describer as one of values: compact, debug, default.

Returns: void

Object literals

Static describers

describers: object

[KINDS.ARRAY]

[KINDS.ARRAY]: ArrayDescriber = ArrayDescriber

[KINDS.CLASS]

[KINDS.CLASS]: ClassDescriber = ClassDescriber

[KINDS.DESCRIPTION_LIST]

[KINDS.DESCRIPTION_LIST]: DescriptionListDescriber = DescriptionListDescriber

[KINDS.ERROR]

[KINDS.ERROR]: ErrorDescriber = ErrorDescriber

[KINDS.NATIVE]

[KINDS.NATIVE]: NativeTypeDescriber = NativeTypeDescriber

[KINDS.OBJECT]

[KINDS.OBJECT]: ObjectDescriber = ObjectDescriber

[KINDS.UNKNOWN]

[KINDS.UNKNOWN]: FallbackDescriber = FallbackDescriber