Skip to content

Taxum / @taxum/core / http / Extensions

Class: Extensions

Defined in: http/extensions.ts:50

A map for setting and retrieving extensions.

The accessors use ExtensionKeys to guarantee type-safety with the associated values.

Implements

Constructors

Constructor

new Extensions(): Extensions

Returns

Extensions

Methods

[TO_HTTP_RESPONSE_PARTS]()

[TO_HTTP_RESPONSE_PARTS](res): void

Defined in: http/extensions.ts:113

Parameters

res

HttpResponseParts

Returns

void

Implementation of

ToHttpResponseParts.[TO_HTTP_RESPONSE_PARTS]


clear()

clear(): void

Defined in: http/extensions.ts:84

Clears all key-value pairs from the map.

Returns

void


extend()

extend(other): this

Defined in: http/extensions.ts:105

Extends the current instance with entries from another instance.

Parameters

other

Extensions

Returns

this


get()

get<T>(key): undefined | T

Defined in: http/extensions.ts:63

Retrieves the value associated with the specified key from the map.

Type Parameters

T

T

Parameters

key

ExtensionKey<T>

Returns

undefined | T


has()

has<T>(key): boolean

Defined in: http/extensions.ts:77

Determines whether the specified key exists in the map.

Type Parameters

T

T

Parameters

key

ExtensionKey<T>

Returns

boolean


insert()

insert<T>(key, value): void

Defined in: http/extensions.ts:56

Inserts a value into the map associated with a specific key.

Type Parameters

T

T

Parameters

key

ExtensionKey<T>

value

T

Returns

void


isEmpty()

isEmpty(): boolean

Defined in: http/extensions.ts:91

Checks whether the map is empty.

Returns

boolean


len()

len(): number

Defined in: http/extensions.ts:98

Retrieves the size of the map.

Returns

number


remove()

remove<T>(key): void

Defined in: http/extensions.ts:70

Removes a value associated with the specified key from the map.

Type Parameters

T

T

Parameters

key

ExtensionKey<T>

Returns

void


toJSON()

toJSON(): Record<string, unknown>

Defined in: http/extensions.ts:117

Returns

Record<string, unknown>