# @rosmarinus/common-utils

> some common utils for rosmarinus

Latest version **3.1.1** (published 2025-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rosmarinus/common-utils
pnpm add @rosmarinus/common-utils
yarn add @rosmarinus/common-utils
bun add @rosmarinus/common-utils
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2025-08-28 |
| First published | 2023-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 3 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | rosmarinus |
| Keywords | utils, rosmarinus |

## Links

- npm: https://www.npmjs.com/package/@rosmarinus/common-utils
- Repository: https://github.com/rosmarinus-project/rosmarinus-universal
- Homepage: https://github.com/rosmarinus-project/rosmarinus-universal#readme
- Issues: https://github.com/rosmarinus-project/rosmarinus-universal/issues
- npm.io page: https://npm.io/package/@rosmarinus/common-utils

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) ^9.0.1
- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [performance-now](https://npm.io/package/performance-now.md) ^2.1.0
- [fast-safe-stringify](https://npm.io/package/fast-safe-stringify.md) ^2.1.1
- [@rollup/plugin-babel](https://npm.io/package/@rollup/plugin-babel.md) ^6.0.4
- [@rosmarinus/babel-plugin-tree-cutting](https://npm.io/package/@rosmarinus/babel-plugin-tree-cutting.md) ^2.1.3

## Recent versions

- 3.1.1 (latest) — 2025-08-28
- 3.1.0 — 2024-06-27
- 3.0.11 — 2024-05-27
- 3.0.10 — 2024-05-27
- 3.0.9 — 2024-05-27
- 3.0.8 — 2024-05-26
- 3.0.7 — 2024-05-26
- 3.0.5 — 2024-05-26
- 3.0.4 — 2023-12-25
- 3.0.3 — 2023-12-14
- 3.0.2 — 2023-12-05
- 3.0.1 — 2023-12-03
- 2.5.0 — 2023-11-25
- 2.4.2 — 2023-11-25
- 2.4.1 — 2023-11-25
- … 33 more at https://npm.io/package/@rosmarinus/common-utils/versions

## README

# @rosmarinus/common-utils

<p align="center">
  <a href="https://www.npmjs.com/package/@rosmarinus/common-utils"><img src="https://img.shields.io/npm/v/@rosmarinus/common-utils" alt="npm package"></a>
  <a href="https://github.com/rosmarinus-project/rosmarinus-universal/actions/workflows/publish.yml"><img src="https://github.com/rosmarinus-project/rosmarinus-universal/actions/workflows/publish.yml/badge.svg" alt="build status"></a>
  <a href="https://pr.new/rosmarinus-project/rosmarinus-universal"><img src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a>
</p>


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

# How to Install

```bash
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.

2. sleep

This module encapsulates several common delay methods into promise output

3. uuid

This module is a wrapper for the uuid npm library

4. AsyncTask

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

4. FileLogger

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

5. json

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

6. is-type

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

7. try

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

8. 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.

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

---
_Source: https://npm.io/package/@rosmarinus/common-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
