Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) });
}
};
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,
});
};
format() {
return formatTemplate(strings.story_courier_kill, {
team: TeamSpan(this.team),
});
}
}
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}>
{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)}
,
,
];
}
}
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) });
}
};
format() {
return formatTemplate(strings.story_firstblood, {
time: formatSeconds(this.time),
killer: PlayerSpan(this.killer),
victim: PlayerSpan(this.victim),
});
}
}
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}>
{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)}
,
const renderSentence = (template, dict) => toSentence(formatTemplate(template, dict));