index.js
function replaceTextWithMap(string, map) {
    // break the words into tokens using _ and words themselves
    const tokens = XRegExp.match(string, /([a-z0-9_]+)/ig);
    // for all the tokens replace it in string
    for(let token of tokens) {
      // try to replace only if the key exists in the map else skip over
      if(map.hasOwnProperty(token)) {
        string = replaceAll(token, map[token], string);
      }
    }
    return string;
  }
function replaceTextWithMap(string, map) {
    // break the words into tokens using _ and words themselves
    const tokens = XRegExp.match(string, /([a-z0-9_]+)/ig);
    // for all the tokens replace it in string
    for(let token of tokens) {
      // try to replace only if the key exists in the map else skip over
      if(map.hasOwnProperty(token)) {
        string = replaceAll(token, map[token], string);
      }
    }
    return string;
  }
function replaceTextWithMap ( string , map ) { // break the words into tokens using _ and words themselves const tokens = XRegExp . match ( string , / ([a-z0-9_]+) / ig ) ; // for all the tokens replace it in string for ( let token of tokens ) { // try to replace only if the key exists in the map else skip over if ( map . hasOwnProperty ( token ) ) { string = replaceAll ( token , map [ token ] , string ) ; } } return string ; }
replace until all of the map has are exhausted
replace until all of the map has are exhausted