1.0.2 • Published 5 years ago
@musicbattles/helpers-utils v1.0.2
Helpers utils
Librería de utilidades. Actualmente cuenta con funciones y directives
Instalación
npm i @musicbattles/helpers-utilsUso
import { Component, OnInit } from '@angular/core';
import { transformUpperCase } from '@musicbattles/helpers-utils;
@Component({
selector: 'app-component',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
ngOnInit(){
const resutl = transformUpperCase("example");
}
}Métodos
| Name | Type | Type value | Description | |
|---|---|---|---|---|
| ConvertColor | static class | string | Transform color hex to rgb | |
| generateFileExcel | function | data: Array, nameFile: string | Generate file Excel | |
| convertExcelToArray | function | file: File | Convert file Excel to Array | |
| convertDataJsonToDataGrid | function | data: Array, headers:Array | Transform data json to data grid | |
| transformUpperCase | function | text: string | Remplace underscore to whiteSpace and uppercase | |
| convertImgTobase64 | function | file: FileList | Transform file to image base64 | |
| getDataUri | function | url: string, callback: Function | Transform url image to image base64 | |
| convertBlobToFile | function | dataBlob: Blob | Convert a file type Blob a File | |
| convertFileToImage | function | file: File | convert file to image. Return to promise | |
| imageBase64ToFile | function | imgBase:string , name:string | Transform image in base64 to file. Return file | |
| parseHTMLToString | function | value: string | Transform HTML to string. Return string | |
| convertSvgToImage | function | data: NodeList | Transform a nodeList into an image. Return Array | |
| donwloadFile | function | url: string | Donwload file from a url | |
| FormatDate.yyyymmdd | static class | date: string | Transform date in YYYY-MM-DD. Return string | |
| FormatDate.ddmmyyyy | static class | date: string | Tranform date in DD-MM-YYYY. Return string | |
| FormatDate.utcFormat | static class | date: string | Transform date in format UTC. Return Date | |
| validateFormatMP4 | function | file: File | Validate file video format. Return boolean | |
| validateSizeVideo | function | file: File | Validate size video format. Return boolean | |
| validateFormatImage | function | file: File | Validate file image format. Return boolean | |
| validateSizeImage | function | file: File | Validate size image format. Return boolean | |
| validateDimentiosImage | function | file: File, width: number, height: number | Validate dimensions image. Return Promise | |
| CustomerValidators.customerValidationEmail | static class | control: AbstractControl | Mail validation through regex. Return ValidationErrors | null |
| CustomerValidators.customerValidationTypeObject | static class | control: AbstractControl | Validate string type. Return ValidationErrors | null |
| CustomerValidators.rangeDate | static class | control: AbstractControl | Valid start date is not greater than the end date. Return ValidationErrors | null |
Directivas
| Name | Name module | Description |
|---|---|---|
| appOnlynumbers | OnlynumbersModule | Validate allows only number entry |
| appValidationFormSubmit | ValidationFormModule | Directive for validate form. Import module ValidationFormModule to its component |
License
MIT