class Facet

A facet represents a span of text within a string with special meaning (e.g. mentions, links, tags).

Constructor

constructor(text, facet)

Creates a new facet.

Parameters

text: string

The full source text.

Properties

sourceText: string

The original text the facet is contained within.

byteIndex: { byteEnd: number; byteStart: number; }

The range of bytes in the source text that this facet applies to, when the source text is encoded as UTF-8. Unless you know what you're doing, you should use the index property.

Properties

byteEnd: number

The index of the first byte excluded from the facet.

byteStart: number

The index of the first byte included in the facet.

features: FacetFeature[]

The decorations applied to the text within the facet range.

Methods

toRecord()

Returns a record representation of the facet.