@rosmarinus/common-utils
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

@rosmarinus/common-utils

npm package build status Start new PR in StackBlitz Codeflow

This npm package contains some function encapsulation commonly used in development, which is more engineering-oriented.

How to Install

npm i @rosmarinus/common-utils

Functions introduction

  1. logger

This module encapsulates chalk as output, and the input parameters are the same as the console module.

  1. sleep

This module encapsulates several common delay methods into promise output

  1. uuid

This module is a wrapper for the uuid npm library

  1. AsyncTask

AsyncTask is an encapsulation of promise and is used in scenarios where calls and callbacks are separated.

  1. FileLogger

FileLogger is a file logger that can be used in nodejs and environments to output log to a local file.

  1. json

This module is a wrapper for the JSON.stringify and JSON.parse methods to make them more secure.

  1. is-type

Some functions to determine the type of data, such as isArray, isObject, isString, etc.

  1. try

This module is a wrapper for try-catch, which can return undefined when an error occurs.

  1. url

This module is a collection of url handle function, such as handling url params to object.

About Tree shaking

this npm doesn't support tree shaking, because it use some npm packages that don't support tree shaking.

But there is always a way to solve this problem, you can use babel-plugin from this npm to solve this problem.

// babel.config.js
module.exports = {
  plugins: ['@rosmarinus/common-utils/babel-plugin'],
};

Readme

Keywords

Package Sidebar

Install

npm i @rosmarinus/common-utils

Weekly Downloads

4

Version

3.1.0

License

MIT

Unpacked Size

3.12 MB

Total Files

98

Last publish

Collaborators

  • rosmarinus