Skip to content

Middleware

Defined in: astrobase/src/middleware/types.ts:5

A middleware that hooks into the transformation process of structured data.

replacer: (key, value, instance) => unknown

Defined in: astrobase/src/middleware/types.ts:20

A function that may alter the value that ends up in the stringified output. This function behaves similarly to the replacer function that can be provided to JSON.stringify. (See: MDN)

If the value is part of an object, this will be the value’s key string. If the value is part of an array, this will be the value’s index number. Otherwise this will be undefined.

undefined | string | number

unknown

The value.

Instance

The Instance config.

unknown

A value to replace the value within the stringified output. If not replacing the value, the input value should be returned.

If performing some validation and it fails, an error should be thrown.


reviver: (key, value, instance) => unknown

Defined in: astrobase/src/middleware/types.ts:40

A function that may alter the value that ends up in the parsed output. This function behaves similarly to the reviver function that can be provided to JSON.parse. (See: MDN)

If the value is part of an object, this will be the value’s key string. If the value is part of an array, this will be the value’s index number. Otherwise this will be undefined.

undefined | string | number

unknown

The value.

Instance

The Instance config.

unknown

A value to replace the value within the parsed output. If not replacing the value, the input value should be returned.

If performing some validation and it fails, an error should be thrown.