Skip to content

@graphty/graphty-element / extend / resolveOptionValues

Function: resolveOptionValues() ​

resolveOptionValues(declared, passed, context): Record<string, unknown>

Defined in: graphty-element/src/catalog/options.ts:170

Fill in the defaults an extension declares and refuse anything it did not.

The result is a plain record, so an extension reads its options as data rather than being handed a validator, a schema object or a class.

Parameters ​

declared ​

readonly OptionDescriptor[]

The options the extension's descriptor declares.

passed ​

Readonly<Record<string, unknown>>

What the caller asked for. Undefined values are treated as absent, so passing { padding: undefined } takes the declared default rather than overriding it with nothing.

context ​

OptionContext

Which extension is being configured, for the failure message.

Returns ​

Record<string, unknown>

Every declared option, with the caller's values where they were given and the declared defaults everywhere else.

Throws ​

A GraphtyError with E_UNKNOWN_OPTION for a name the extension does not declare, or E_OPTION_RANGE for a value it would not accept.