# @cuser/utils

> common utils used by cuser

Latest version **0.0.36** (published 2020-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cuser/utils
pnpm add @cuser/utils
yarn add @cuser/utils
bun add @cuser/utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.36 |
| Published | 2020-12-24 |
| First published | 2020-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | rubeniskov |
| Maintainers | rubeniskov |

## Links

- npm: https://www.npmjs.com/package/@cuser/utils
- Repository: https://github.com/rubeniskov/cuser
- Homepage: https://github.com/rubeniskov/cuser#readme
- Issues: https://github.com/rubeniskov/cuser/issues
- npm.io page: https://npm.io/package/@cuser/utils

## Dependencies (1)

- [uuid](https://npm.io/package/uuid.md) ^8.3.1

## Recent versions

- 0.0.36 (latest) — 2020-12-24
- 0.0.35 — 2020-12-23
- 0.0.34 — 2020-12-23
- 0.0.33 — 2020-12-23
- 0.0.32 — 2020-12-23
- 0.0.31 — 2020-12-23
- 0.0.30 — 2020-12-23
- 0.0.29 — 2020-12-23
- 0.0.27 — 2020-12-22
- 0.0.26 — 2020-12-22
- 0.0.25 — 2020-12-22
- 0.0.18 — 2020-12-22
- 0.0.17 — 2020-12-22
- 0.0.16 — 2020-12-22
- 0.0.12 — 2020-12-22
- … 3 more at https://npm.io/package/@cuser/utils/versions

## README

<p align="center">
  <a href="./"><img width="250" src="https://raw.githubusercontent.com/rubeniskov/cuser/master/docs/logo.svg" alt="cuser logo" /></a>
</p>

## Status
[![codecov](https://codecov.io/gh/rubeniskov/cuser/branch/master/graph/badge.svg?flag=utils)](https://codecov.io/gh/rubeniskov/cuser)
[![npm](https://img.shields.io/npm/v/@cuser/utils.svg)](https://www.npmjs.com/package/@cuser/utils)
[![npm-downloads](https://img.shields.io/npm/dw/@cuser/utils)](https://www.npmjs.com/package/@cuser/utils)


# @cuser/utils

## Index

### Functions

* [assert](docs/globals.md#assert)
* [formatErr](docs/globals.md#formaterr)
* [timestamp](docs/globals.md#timestamp)

## Functions

### assert

▸ `Const`**assert**(`assertion`: any, ...`args`: any[]): void

*Defined in [assert.js:12](https://github.com/rubeniskov/cuser/blob/f3dfb9e/packages/utils/assert.js#L12)*

Asserts a condition to raise an error when not fullfilled

**`example`** 
```javascript
assert(true, 'should not raise the custom error with args %s', 'foo');
assert(false, 'should raise the custom error with args %s', 'foo');
```

#### Parameters:

Name | Type |
------ | ------ |
`assertion` | any |
`...args` | any[] |

**Returns:** void

___

### formatErr

▸ `Const`**formatErr**(...`args`: any[]): Error

*Defined in [formatErr.js:12](https://github.com/rubeniskov/cuser/blob/f3dfb9e/packages/utils/formatErr.js#L12)*

Formats an error like sprintf

**`example`** 
```javascript
formatErr('messsage error with argument %s', 'foo')
formatErr(TypeError, 'messsage error with argument %s and custom Error constructor', 'foo')
```

#### Parameters:

Name | Type |
------ | ------ |
`...args` | any[] |

**Returns:** Error

___

### timestamp

▸ `Const`**timestamp**(): number

*Defined in [timestamp.js:5](https://github.com/rubeniskov/cuser/blob/f3dfb9e/packages/utils/timestamp.js#L5)*

Gets current timestamp

**Returns:** number

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