npm install @baloise/web-app-pipes
Use pipe function to transform any kind of data to a display format. The pipe are simple functions which always return a string. Just import the function and use it to transform data in to readable strings.
import { balCapitalize } from '@baloise/web-app-pipes'
balCapitalize('baloise')
// returns 'Baloise'
balBlobToUrl(value: Blob) => string
Transforms the given blob parameter to object URL string.
For more information look up the documentation about URL.createObjectURL
balCapitalize(value: any) => string
Transforms the given string parameter to capitalize string.
balCapitalize('baloise') // Baloise
balClaimNumber(value: any) => string
Transforms the given string into the correct claim-number format.
balClaimNumber('73001217169') // 73/001217/16.9
balContractNumber(value: any) => string
Transforms the given string into the correct police-number format.
balContractNumber('501222333') // 50/1.222.333
balCurrency(value: any, currencySign: any, showZero: any, decimalLength: any) => string
Formats the number into a human readable currency string.
balCurrency(1234567.89) // 1'234'567.89
balDateString(value: any) => string
Transforms the given string parameter to capitalize string.
balDateString(new Date(2022, 11, 31)) // '2022-12-31'
balDefaultString(value: any, defaultString: any) => string
If the value is empty it shows a dash ('-').
balDefaultString('') // -\n
balDefaultString('text') // text
balFileSize(value: number) => string
Transforms the filesize in human readable string.
balFileSize(86956565) // 82.9 MB
balHighlight(value: string, search: string, cssClass: any) => string
Transforms the given text into a highlighted html content.
balHighlight('Some Text') // <span class="bal-highlight">Some Text</span>
balHighlightStartsWith(value: string, search: string, cssClass: any) => string
Transforms the given text into a highlighted html content.
balHighlightStartsWith('Some Text', 'Some') // <span class="bal-highlight">Some</span> Text
balJoinArray(value: any, delimiter: any) => string
Transforms the given string array in to a string.
balJoinArray(['Apple', 'Potato', 'Bacon']) // Apple, Potato, Bacon
balLimit(value: any, limit: any) => string
Limits the input string.
balLimit('Some string that is ways to long to be rendered') // Some string that is ...
balOfferNumber(value: any, varianteNr: string) => string
Transforms the input string into a offer number.
balOfferNumber('987654321') // 98/7.654.321
balPhoneNumber(value: any) => string
Formats the given phone.
balPhoneNumber('41,41564410808') // +41 56 441 08 08
balPhoneNumber({ countryCode: '41', phoneNumber: '564410808' }) // +41 56 441 08 08