Skip to content

Function: resolveConfig()

ts
function resolveConfig(userConfig?): SecurityConfig;

Merge a partial user-supplied config on top of DEFAULT_SECURITY_CONFIG.

Pure — does not mutate inputs. Arrays are shallow-copied so subsequent caller mutation of their source array does not affect the merged config.

Resolution rules:

  • allowedOrigins: user value overrides default (including the empty default). If user omits the key, the default empty array is used.
  • strictMode: user value overrides; default true applies if omitted.
  • additionalOrigins: user value copied as-is; undefined if omitted.

Parameters

ParameterTypeDescription
userConfig?Partial<SecurityConfig>A partial config; any subset of fields is accepted. Pass undefined to get a defensive copy of the default.

Returns

SecurityConfig

A fully-populated SecurityConfig.