Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

mergeFormattingSettings

function mergeFormattingSettings(base, overrides?): FormattingSettings;

Defined in: packages/engine/src/format/FormattingSettings.ts:237

Settings with some groups or fields replaced, merged group by group.

A group the overrides name is merged field by field over the base’s, so { numberResult: { decimalSeparatorLocale: "de-DE" } } changes the locale and keeps every other setting. A field set to undefined leaves the base’s value, as a missing one does. calendar is taken from the overrides when they name one. A value that is not an object where a group belongs, and a key that is not a group, are ignored rather than thrown on, so a settings object from an older or newer host still formats.

ParameterTypeDescription
baseFormattingSettingsThe complete settings to start from.
overrides?| FormattingOverrides | nullWhat to change, or nothing for the base unchanged.

FormattingSettings

Complete settings: base itself when there is nothing to merge, and a new object otherwise. Nothing is remembered between calls, so a host that edits its settings object in place sees the edit.