@baloise/web-app-pipes
TypeScript icon, indicating that this package has built-in type declarations

3.11.4 • Public • Published

@baloise/web-app-pipes

Continuous Release npm npm bundle size npm GitHub GitHub issues

Installation

npm install @baloise/web-app-pipes

Usage

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'

API

balBlobToUrl

balBlobToUrl(value: Blob) => string

Transforms the given blob parameter to object URL string.

For more information look up the documentation about URL.createObjectURL

balCapitalize

balCapitalize(value: any) => string

Transforms the given string parameter to capitalize string.

balCapitalize('baloise') // Baloise

balClaimNumber

balClaimNumber(value: any) => string

Transforms the given string into the correct claim-number format.

balClaimNumber('73001217169') // 73/001217/16.9

balContractNumber

balContractNumber(value: any) => string

Transforms the given string into the correct police-number format.

balContractNumber('501222333') // 50/1.222.333

balCurrency

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

balDateString(value: any) => string

Transforms the given string parameter to capitalize string.

balDateString(new Date(2022, 11, 31)) // '2022-12-31'

balDefaultString

balDefaultString(value: any, defaultString: any) => string

If the value is empty it shows a dash ('-').

balDefaultString('') // -\n
balDefaultString('text') // text

balFileSize

balFileSize(value: number) => string

Transforms the filesize in human readable string.

balFileSize(86956565) // 82.9 MB

balHighlight

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

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

balJoinArray(value: any, delimiter: any) => string

Transforms the given string array in to a string.

balJoinArray(['Apple', 'Potato', 'Bacon']) // Apple, Potato, Bacon

balLimit

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

balOfferNumber(value: any, varianteNr: string) => string

Transforms the input string into a offer number.

balOfferNumber('987654321') // 98/7.654.321

balPhoneNumber

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

Readme

Keywords

none

Package Sidebar

Install

npm i @baloise/web-app-pipes

Weekly Downloads

16

Version

3.11.4

License

Apache-2.0

Unpacked Size

82.6 kB

Total Files

23

Last publish

Collaborators

  • assistentenitch
  • madalina.iacob
  • yannickholzenkamp
  • montakasparsone
  • team_mortal
  • mladenplaninicic
  • nobilo
  • thomasseyssenstpo
  • se-aperto-com
  • baopso
  • hirsch88