npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

infra-services

v1.0.22

Published

Clases basadas en el sdk de AWS para optimizar desarrollos en el área de infraestructura.

Downloads

3

Readme

infra-utils

Utilerías para optimizar el desarrollo del área de infraestructura.

Instalación

Ejecuta el siguiente comando

npm i infra-utils

Implementación

Puedes configurar la librería para que habilite los logs y/o el formato por default que se usará para pasar de string a date o visceversa.

 const INSTANCE = InfraUtils.getInstance({
   debug: true,
   defaultDateTimeFormat: 'DD-MM-YYY HH:mm:ss'
 });

También puedes configurarlo por separado usando los métodos setDebug y setDefaultDateTimeFormat

const INSTANCE = InfraUtils.getInstance();
INSTANCE.setDebug(false);
INSTANCE.setDefaultDateTimeFormat('DD-MM-YYYY');

Utilerias

La librería contiene las siguientes clases:

  • Converter: Convierte de date a string y visceversa.
  • Generic: Valida si una promesa fue exitosa o fallida.
  • Logger: Contiene métodos para loguear por consola, sólo si se activa el modo debug en la configuración inicial o mediante el método InfraUtils.getInstance().setDebug(true);.

Uso de clase Converter

Para convertir un tipo date a un string se usa el método dateToString

const strDate = Converter.dateToString(new Date(2020, 0, 1), 'DD-MM-YYYY'); //Output 01-01-2020
const strDate = Converter.dateToString(new Date(2020, 0, 1)); //Output 2020-01-01 00:00:00 

Para el proceso inverso se usa el método stringToDate

const date = Converter.stringToDate('31-12-2020', 'DD-MM-YYYY');
const date = Converter.dateToString('2020-12-31');

Uso de clase Generic

Para validar una promesa se ocupa el método validatePromise

Generic.validatePromise(new Error('Error Genérico'), {foo: 'bar'}, (data) => {
    //Do something with data
}, (error) => {
    //Do something with error
});

Uso de clase Logger

Para loguear por consola un mensaje se ocupa el método logMessage

Logger.logMessage('Esto es un mensaje de prueba');

Para loguear un error por consola se ocupa el método logError

Logger.logError(new Error('Custom Error'));

Para loguear un objeto por consola se ocupa el método logData

Logger.logData({foo: 'bar'});

Si se desea agregar un texto antes del error, se ocupa el método describeError

Logger.describeError('Error', new Error('Custom Error'));

Si se desea agregar un texto antes del objeto, se ocupa el método describeData

Logger.describeData('Response', {success: true, code: 200, message: 'Request processed successfully'});

Built With

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Malco Jesse Cruz Santos - DevOps Developer