0.1.2 • Published 9 months ago

@ariasc/nest-common v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Angular Common Library

npm npm npm

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.

0.1.2

9 months ago

0.0.2

12 months ago

0.0.1

12 months ago