本文整理汇总了TypeScript中accounting.formatMoney函数的典型用法代码示例。如果您正苦于以下问题:TypeScript formatMoney函数的具体用法?TypeScript formatMoney怎么用?TypeScript formatMoney使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatMoney函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(rows: PlayerEarningsDisplayRow[], bonus1: boolean, bonus2: boolean, bonusAmount: number) {
const total = Enumerable.from(rows).sum((row) => row.earned) +
(bonus1 ? bonusAmount : 0) + (bonus2 ? bonusAmount : 0);
this.rows = rows;
this.total = total;
this.totalDisp = accounting.formatMoney(total, "$", 0);
this.bonus1 = bonus1;
this.bonus2 = bonus2;
this.bonusAmount = bonusAmount;
this.bonusAmountDisp = accounting.formatMoney(this.bonusAmount, "$", 0);
}
示例2: formatMoney
export default function formatMoney(
moneyValue: string,
opts: Handlebars.HelperOptions
) {
let pattern = opts.hash.pattern || DEFAULT_PATTERN;
return accounting.formatMoney(moneyValue);
}
示例3: constructor
constructor(name: string, bonus1Selection: boolean, bonus2Selection: boolean, shares: number, earned: number) {
this.name = name;
this.bonus1Selection = bonus1Selection;
this.bonus2Selection = bonus2Selection;
this.shares = shares;
this.earned = earned;
this.earnedDisp = accounting.formatMoney(earned, "$", 0);
}
示例4: formatMoney
/**
* Format number into euros.
*/
function formatMoney(amount: number) {
return accounting.formatMoney(amount, {
symbol: 'âŹ',
format: '%v %s',
decimal: ',',
thousand: '.',
precision: 2
})
}
示例5: constructor
constructor(movie: Movie, isBestMovie: boolean, isWorstMovie: boolean, shares: number, gross: number) {
const value = gross / shares || 0;
this.id = movie.id;
this.name = movie.name;
this.releaseDateInt = parseInt(moment(movie.releaseDate).format("X"), 10);
this.releaseDate = moment(movie.releaseDate).format("MMM DD");
this.rating = movie.rating;
this.isBestMovie = isBestMovie;
this.isWorstMovie = isWorstMovie;
this.posterUrl = `/images/${(movie.imdb || "").replace("https://www.imdb.com/title/", "")}.jpg`;
this.shares = shares;
this.gross = gross;
this.grossDisp = accounting.formatMoney(gross, "$", 0);
this.grossDispShort = MovieHelpers.formatShortCurrency(gross);
this.value = value;
this.valueDisp = accounting.formatMoney(value, "$", 0);
this.valueDispShort = MovieHelpers.formatShortCurrency(value);
}
示例6: constructor
constructor(movie: Movie, shares: number, earned: number, bonus1: boolean, bonus2: boolean) {
this.name = movie.name;
this.releaseDate = moment(movie.releaseDate).format("MMM DD");
this.shares = shares;
this.earned = earned;
this.earnedDisp = accounting.formatMoney(earned, "$", 0);
this.bonus1Selection = bonus1;
this.bonus2Selection = bonus2;
}
示例7: constructor
constructor(player: Player, hasBonus1: boolean, hasBonus2: boolean, sharesUsed: number, total: number) {
this.rank = 0;
this.name = player.name;
this.id = player.id;
this.hasBonus1 = hasBonus1;
this.hasBonus2 = hasBonus2;
this.sharesUsed = sharesUsed;
this.total = total;
this.totalDisp = accounting.formatMoney(total, "$", 0);
this.perShare = total / sharesUsed || 0;
this.perShareDisp = MovieHelpers.formatShortCurrency(sharesUsed > 0 ? total / sharesUsed : 0);
this.enteredMoneyPool = player.enteredMoneyPool;
}
示例8: downloadEarnings
public async downloadEarnings(): Promise<void> {
const date: Date = moment().tz("America/New_York").toDate();
const dateStr: string = moment().tz("America/New_York").format("YYYY-MM-DD");
const dateThreshold: Date = moment().add(5, "days").tz("America/New_York").toDate();
const currentSeason = await this.sql.getSelectedSeason(undefined);
if (currentSeason === undefined || currentSeason.getEndDate() < date) {
return;
}
const moviesToGet = Enumerable.from(currentSeason.movies)
.where((m) => m.releaseDate <= dateThreshold)
.orderByDescending((m) => m.releaseDate)
.toArray();
let earnings: Earning[] = [];
for (const url of currentSeason.urls) {
const html = await this.http.download(url.url, {});
const rows = MojoParser.parse(html);
const earningsToAdd = MojoParser.getEarnings(rows, moviesToGet);
earnings = earnings.concat(earningsToAdd);
}
for (const earning of earnings) {
const value = accounting.formatMoney(earning.gross, "$", 0);
this.output.write(`${earning.movie.name}: ${value}\n`);
}
await this.sql.deleteEarningsForDate(dateStr);
const addPromise = this.sql.addEarningsForMovies(earnings);
this.output.write("\n");
const ratingsPromises: Array<Promise<void>> = [];
for (const movie of moviesToGet) {
if (movie.metacriticUrl === undefined) {
continue;
}
const rating = await this.getRating(movie.metacriticUrl, 0);
if (rating === undefined) {
continue;
}
ratingsPromises.push(this.sql.updateRatingForMovie(movie, rating));
this.output.write(`${movie.name}: ${rating}%\n`);
}
await addPromise;
await Promise.all(ratingsPromises);
}
示例9: getFormattedBonusAmount
public getFormattedBonusAmount(): string {
return accounting.formatMoney(this.bonusAmount, "$", 0);
}
示例10: totalEarnedDisp
public totalEarnedDisp() {
const totalEarned = Enumerable.from(this.rows).select((r) => r.earned).sum();
return accounting.formatMoney(totalEarned, "$", 0);
}