How to use the utility.formatTemplate function in utility

To help you get started, we’ve selected a few utility examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github odota / web / src / components / Match / MatchStory.jsx View on Github external
const formatList = (list, noneValue = []) => {
  switch (list.length) {
    case 0:
      return noneValue;
    case 1:
      return list;
    case 2:
      return formatTemplate(strings.story_list_2, { 1: list[0], 2: list[1] });
    case 3:
      return formatTemplate(strings.story_list_3, { 1: list[0], 2: list[1], 3: list[2] });
    default:
      return formatTemplate(strings.story_list_n, { i: list.shift(), rest: formatList(list) });
  }
};
github odota / web / src / components / Match / MatchStory.jsx View on Github external
const formatBuilding = (event) => {
  let template = strings.story_building_destroy;
  if (event.player) {
    template = event.player.isRadiant === event.team ? strings.story_building_deny_player : strings.story_building_destroy_player;
  }
  return formatTemplate(template, {
    building: event.localizedBuilding,
    player: event.player ? PlayerSpan(event.player) : null,
  });
};
github odota / web / src / components / Match / MatchStory.jsx View on Github external
format() {
    return formatTemplate(strings.story_courier_kill, {
      team: TeamSpan(this.team),
    });
  }
}
github odota / web / src / components / Match / MatchStory.jsx View on Github external
format() {
    return [
      <h3 style="{{">
        {formatTemplate(strings.story_time_marker, { minutes: this.minutes })}
      </h3>,
      
        
          {GoldSpan(this.radiant_gold)}
        
         this.dire_gold ? constants.colorGreen : constants.colorRed} left={this.radiant_percent}&gt;
          {formatTemplate(strings.story_networth_diff, {
            percent: Math.abs(this.radiant_percent - this.dire_percent),
            gold: GoldSpan(Math.abs(this.radiant_gold - this.dire_gold)),
          })}
        
        
          {GoldSpan(this.dire_gold)}
        
      ,
      
        
        
      ,
    ];
  }
}
github odota / web / src / components / Match / MatchStory.jsx View on Github external
const formatList = (list, noneValue = []) => {
  switch (list.length) {
    case 0:
      return noneValue;
    case 1:
      return list;
    case 2:
      return formatTemplate(strings.story_list_2, { 1: list[0], 2: list[1] });
    case 3:
      return formatTemplate(strings.story_list_3, { 1: list[0], 2: list[1], 3: list[2] });
    default:
      return formatTemplate(strings.story_list_n, { i: list.shift(), rest: formatList(list) });
  }
};
github odota / web / src / components / Match / MatchStory.jsx View on Github external
format() {
    return formatTemplate(strings.story_firstblood, {
      time: formatSeconds(this.time),
      killer: PlayerSpan(this.killer),
      victim: PlayerSpan(this.victim),
    });
  }
}
github odota / web / src / components / Match / MatchStory.jsx View on Github external
format() {
    return [
      <h3 style="{{">
        {formatTemplate(strings.story_time_marker, { minutes: this.minutes })}
      </h3>,
      
        
          {GoldSpan(this.radiant_gold)}
        
         this.dire_gold ? constants.colorGreen : constants.colorRed} left={this.radiant_percent}&gt;
          {formatTemplate(strings.story_networth_diff, {
            percent: Math.abs(this.radiant_percent - this.dire_percent),
            gold: GoldSpan(Math.abs(this.radiant_gold - this.dire_gold)),
          })}
        
        
          {GoldSpan(this.dire_gold)}
        
      ,
github odota / web / src / components / Match / MatchStory.jsx View on Github external
const renderSentence = (template, dict) => toSentence(formatTemplate(template, dict));