1.2.1 • Published 8 months ago

ngx-custom-pipe v1.2.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
8 months ago

npm NPM Downloads NPM Downloads License GitHub issues

A TypeScript library, designed to convert any numeric number into its corresponding representation in words. The pipe comes in two numbering systems, The Indian Numbering System and The International Numbering System. This powerful pipe eliminates the need for developers to manually implement the logic, saving development time and enabling a faster and more focused development process. Particularly useful in generating invoices, generating reports, or presenting numeric data to end-users in a more friendly and understandable way.

Table of contents

Installation

  1. Run the following command at the root of your project:

    npm install ngx-custom-pipe

This will install the ngx-custom-pipe package as a project dependency in the node_modules folder.

Usage

  1. Import the NgxCustomPipeModule module in your *.module.ts:

    import { NgxCustomPipeModule } from 'ngx-custom-pipe';
  2. Add the NgxCustomPipeModule module to the imports array of your @NgModule decorator:

    import { NgxCustomPipeModule } from 'ngx-custom-pipe';
    
    @NgModule({
        // ...
        imports: [
        // ...
        NgxCustomPipeModule
        ]
    })
  1. Pipes can also be injected into components or services. Declare the pipe in the providers array of your *.module.ts or *.component.ts:

    For example:

    import { NgxCustomPipe } from 'ngx-custom-pipe';
    
    @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.scss'],
        providers: [NumberToWordsPipe]
    })
    export class AppComponent {
        title = 123456789;
        
        constructor(private numberToWordsPipe: NumberToWordsPipe) {
            console.log(this.numberToWordsPipe.transform(this.title));
        }
    }

    NOTE: By default, the pipe uses the International Numbering System. To use the Indian Numbering System, pass 'INR' as a parameter to the pipe.

    For example:

    import { NgxCustomPipe } from 'ngx-custom-pipe';
    
    @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.scss'],
        providers: [NumberToWordsPipe]
    })
    export class AppComponent {
        title = 123456789;
        
        constructor(private numberToWordsPipe: NumberToWordsPipe) {
            console.log(this.numberToWordsPipe.transform(this.title, 'INR'));
        }
    }
  2. Pipes can also be used in templates.

    <p>{{ 1234567890 | numberToWords }}</p>

    To use the Indian Numbering System, pass 'INR' as a parameter to the pipe.

    <p>{{ 1234567890 | numberToWords: 'INR' }}</p>

Contributing

To contribute to this project, please read the CONTRIBUTING.md file.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

1.2.0

8 months ago

1.2.1

8 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

0.0.1

11 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago