@ariasc/nest-common
v0.1.2
Published
![npm](https://img.shields.io/npm/v/@ariasc/nest-common) ![npm](https://img.shields.io/npm/l/@ariasc/nest-common) ![npm](https://img.shields.io/npm/dw/@ariasc/nest-common)
Downloads
154
Readme
Angular Common Library
A collection of helpful utilities , interfaces , constants and parsers for use in your angular applications. This library provides common functionality that can be reused across different parts of your application to reduce redundancy and improve code maintainability.
Installation
To install the library, run:
npm install @ariasc/nest-common
or with yarn:
yarn add common
Features
- Helper Functions: A set of utility functions that simplify common tasks.
- Parsers: Functions to parse and transform data.
- Decorators: Custom decorators for enhancing your angular application.
- Guards: Pre-built guards to protect your routes.
- Interfaces: Common interfaces for typing.
- Constants: Reusable constants for various logics.
Usage
Importing the Library
First, import the library in your angular module:
import { Module } from "@angular/common";
import { YourHelperService, YourParserService } from "@ariasc/nest-common";
@Module({
providers: [YourHelperService, YourParserService],
exports: [YourHelperService, YourParserService],
})
export class AppModule {}
Helper Functions
Use the provided helper functions in your services or controllers:
import { Injectable } from "@angular/common";
import { YourHelperService } from "@ariasc/nest-common";
@Injectable()
export class SomeService {
constructor(private readonly helperService: YourHelperService) {}
someMethod() {
this.helperService.someHelperFunction();
}
}
Parsers
Use the parsers to transform data:
import { Injectable } from "@angularjs/common";
import { YourParserService } from "@ariasc/nest-common";
@Injectable()
export class AnotherService {
constructor(private readonly parserService: YourParserService) {}
anotherMethod(data: any) {
const parsedData = this.parserService.someParserFunction(data);
return parsedData;
}
}
Interfaces
Use the Inerfaces to validate data types:
import { Injectable } from "@angular/core";
import { YourInterface } from "@ariasc/nest-common";
import { YourParserService } from "@ariasc/nest-common";
@Injectable()
export class AnotherService {
param: YourInterface;
constructor(private readonly parserService: YourParserService) {}
anotherMethod() {
const parsedData = this.parserService.someParserFunction<YourInterface>(this.param);
return parsedData;
}
}
Documentation
For detailed documentation on each function, parser, and utility provided by this library, please refer to the API Documentation.
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you have any questions or need support, please open an issue on our GitHub issues page.