@rosmarinus/common-utils
v3.1.0
Published
some common utils for rosmarinus
Downloads
14
Readme
@rosmarinus/common-utils
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
- logger
This module encapsulates chalk as output, and the input parameters are the same as the console module.
- sleep
This module encapsulates several common delay methods into promise output
- uuid
This module is a wrapper for the uuid npm library
- AsyncTask
AsyncTask is an encapsulation of promise and is used in scenarios where calls and callbacks are separated.
- FileLogger
FileLogger is a file logger that can be used in nodejs and environments to output log to a local file.
- json
This module is a wrapper for the JSON.stringify and JSON.parse methods to make them more secure.
- is-type
Some functions to determine the type of data, such as isArray, isObject, isString, etc.
- try
This module is a wrapper for try-catch, which can return undefined when an error occurs.
- 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'],
};