2.1.1 • Published 1 year ago
ng-letter-count-2 v2.1.1
letter-count for Angular
This library was generated with Angular CLI version 15.1.0.
Table of contents
Installation
- Use npm to install the package:
$ npm install ng-letter-count-2 --save
- Use yarn to install the package:
$ yarn add ng-letter-count-2
Useage
You could either add into your module
imports
theNgLetterCountModule
in order to add everything.import { NgLetterCountModule } from 'ng-letter-count-2'; @NgModule({ // ... imports: [ // ... NgLetterCountModule ] })
Or Pipes are also injectable and can be used in Components / Services / etc..
import { NgLetterCountPipe } from 'ng-letter-count-2'; @Component({ // .. providers: [NgLetterCountPipe] }) export class AppComponent { public title = 'AppComponent by Tom S.'; constructor(private readonly ngLetterCountPipe: NgLetterCountPipe) { ngLetterCountPipe.transform(this.title, '-w'); // Returns: 4 } // .. }
You can use pipes as part of your template for ex.
<p>{{ 'AppComponent by Tom S.' | letterCount }}</p> <!-- Output: 22 -->
and it's also possible to stack multiple pipes
<p>{{title | uppercase | letterCount: '-c'}}</p> <!-- Output: 22 -->
Options
Counts the:
Type | Option |
---|---|
▶ characters | '-c' or '--char' |
▶ lines | '-ln' or '--lines' |
▶ words | '-w' or '--words' |
▶ numbers | '-n' or '--numbers' |
▶ integers | '-int' or '--integers' |
▶ floats | '-fl' or '--floats' |
▶ spaces | '-s' or '--spaces' |
▶ letters | '-l' or '--letters' |
▶ wordsigns | '-ws' or '--wordsigns' |
⭐ Generates a hash (MD5) | '-hs' or '--hash' |
NPM
https://npmjs.com/package/ch.techstack.ng-lib-workspace
Doc
RinKit
https://npm.runkit.com/ng-letter-count-2
Links
License
This library is available under the MIT license.