1import * as _ from 'lodash-es'2import { replaceStrict } from './replaceStrictF.mts'3import { assertString } from '../assertsF/assertStringF.mts'5export const replaceAllStrict = (contents: string, fromStr: string, toStr: string): string => {6 if (fromStr == toStr) return contents7 contents = replaceStrict(contents, fromStr, toStr)8 while (_.includes(contents, fromStr)) {9 contents = replaceStrict(contents, fromStr, toStr)10 }11 return contents12}14export const replaceAll = (contents: string, fromStr: string, toStr: string): string => {15 assertString(fromStr)16 assertString(toStr)17 if (!_.includes(contents, fromStr)) return contents18 return replaceAllStrict(contents, fromStr, toStr)19}