2.0.0 • Published 3 years ago

@terminus/ui-pipes v2.0.0

Weekly downloads
22
License
MIT
Repository
github
Last release
3 years ago

CI/CD Status Codecov MIT License
NPM version Library size

Table of Contents

Installation

Packages that need to be installed

  • @angular/cdk
  • @angular/common
  • @angular/core
  • @angular/forms
  • @angular/platform-browser
  • @terminus/fe-utilities
  • @terminus/ui-utilities
  • @terminus/ui-pipes
  • date-fns

Use the ng add command to quickly install all the needed dependencies:

ng add @terminus/ui-pipes

Modules that need to be in NgModule

  • TsPipesModule

Available pipes

PipeNotes
tsAbbreviateNumberAbbreviate a number
tsDateshort, medium, extended, timestamp
tsRoundNumberRound a number to a specific precision
tsSentenceCaseConvert string casing to sentence-case
tsTimeAgoHuman-readable time span
tsTitleCaseTitle Case A String
tsTruncateAtTruncate a string, start, middle, end

Usage

HTML

Import the TsPipesModule module into your app:

import { TsPipesModule } from '@terminus/ui-pipes';

@NgModule({
  imports: [
    ...
    TsPipesModule,
  ],
  ...
})
export class AppModule {}

Then use the pipe in HTML:

{{ 'HERE IS MY STRING' | tsSentenceCase }}

If the pipe takes parameters, pass them in after the pipe name:

{{ '1200' | tsAbbreviateNumber:2:false }}

Class

Import the pipes module to your app:

import { TsPipesModule } from '@terminus/ui-pipes';

@NgModule({
  ...
  imports: [TsPipesModule],
  ...
})
export class AppModule {}

Then inject the pipe into your class and use:

import { TsSentenceCasePipe } from '@terminus/ui-pipes';

@Component({ ... })
export class MyComponent {
  myString = this.sentenceCasePipe.transform('ANOTHER STRING');

  constructor(private sentenceCasePipe: TsSentenceCasePipe) {}
}
2.0.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1

4 years ago