UNPKG

string-replace-all

Version:

Replaces all the occurrences of a string into a string with another string.

17 lines (8 loc) 275 B
/* IMPORT */ import escape from 'string-escape-regex'; /* MAIN */ const replaceAll = ( str: string, find: string, replacement: string ): string => { return str.replace ( new RegExp ( escape ( find ), 'g' ), replacement ); }; /* EXPORT */ export default replaceAll;