Skip to content

replace

Replaces occurrences of strings in a given string based on a replacements map.

Import:

import { replace } from 'obsidian-dev-utils/string';

Signature:

function replace(str: string, replacementsMap: Record<string, string>): string

Parameters:

ParameterTypeDescription
strstringThe string to perform replacements on.
replacementsMapRecord<string, string>An object mapping strings to their replacement values.

Returns: string — The modified string with replacements applied.