use js toLocaleString rather than custom insert commas function

ref #272
This commit is contained in:
Collin M. Barrett 2018-06-07 14:00:14 -05:00
parent e79d26ddbc
commit 84d1cf2831

View file

@ -58,17 +58,12 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
private static renderTagline(state: IHomeState) {
return <p className="ml-2 mr-2">
The independent, comprehensive directory of <strong>{this.insertCommasInNumber(state.ruleCount)
The independent, comprehensive directory of <strong>{state.ruleCount.toLocaleString()
}</strong> unique rules across <strong>{state.lists.length
}</strong> filter and host lists for advertisements, trackers, malware, and annoyances.
</p>;
}
//https://stackoverflow.com/a/2901298/2343739
private static insertCommasInNumber(num: number) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
private static renderFilterListsTable(filterLists: IListDto[]) {
return <ReactTable
data={filterLists}