UNPKG

@ctodev/cclibrary-typings

Version:

Library typings for use with CLARC INFINITY

30 lines (29 loc) 1.3 kB
import { DecimalPipe } from "@angular/common"; import { TccBankersRoundingPipe } from "../../../../pipes/tcc-bankers-rounding/tcc-bankers-rounding.pipe"; import { LocaleService } from "../../../../../core/services/tcc-locale/tcc-locale.service"; /** * Provides utility functions for common calculations and value formatting. */ export declare class TccClientUtils { private localeService; private bankersRoundingPipe; private decimalPipe; constructor(localeService: LocaleService, bankersRoundingPipe: TccBankersRoundingPipe, decimalPipe: DecimalPipe); /** * BankersRounding for numbers. On .5 round to the next even number. * @param value the value to round * @param decimalPlaces number of decimal places the result should have * @example * 3.5 rounded to 4 * 4.5 rounded to 4 * @returns the rounded value */ roundValue(value: number, decimalPlaces: number): number; /** * Transforms a number to a string in the current user language. Rounds if necessary using bankers rounding. * @param value the value to transform * @param decimalPlaces number of decimal places the result should have * @returns the transformed value */ numberToLocalizedString(value: number, decimalPlaces?: number): string; }