Skip to content

replace

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

Import:

import { replace } from '@mnaoumov/typescript-lib/string';

Signature:

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

Parameters:

Parameter Type Description
$string string
replacementsMap Record<string, string> An object mapping strings to their replacement values.

Returns: string — The modified string with replacements applied.