# @cantinc/utils

> Cant inc. utils

Latest version **1.4.4** (published 2025-07-01) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.4 |
| Published | 2025-07-01 |
| First published | 2022-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 31.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mikhail Lysikov |
| Maintainers | deight, cant-inc |
| Keywords | innet, utils, front-end |

## Links

- npm: https://www.npmjs.com/package/@cantinc/utils
- Repository: https://github.com/cantinc/utils
- Issues: https://github.com/cantinc/utils/issues
- npm.io page: https://npm.io/package/@cantinc/utils

## Dependencies (1)

- [url-regex](https://npm.io/package/url-regex.md) ^5.0.0

## Recent versions

- 1.4.4 (latest) — 2025-07-01
- 1.4.3 — 2025-06-17
- 1.4.2 — 2023-01-29
- 1.4.1 — 2023-01-09
- 1.4.0 — 2022-12-02
- 1.3.1 — 2022-12-01
- 1.3.0 — 2022-11-16
- 1.2.7 — 2022-11-10
- 1.2.6 — 2022-11-06
- 1.2.5 — 2022-11-06
- 1.2.4 — 2022-09-27
- 1.2.3 — 2022-09-27
- 1.2.2 — 2022-09-27
- 1.2.1 — 2022-09-27
- 1.2.0 — 2022-09-22
- … 6 more at https://npm.io/package/@cantinc/utils/versions

## README

<a href="https://github.com/cantinc">
  <img align="left" width="90" height="90" alt="CANT.store" src="https://raw.githubusercontent.com/cantinc/logger/v1.0.6/img/cant.store.png">
</a>

# &nbsp;utils

&nbsp;

[![NPM](https://img.shields.io/npm/v/@cantinc/utils.svg)](https://www.npmjs.com/package/@cantinc/utils)
[![downloads](https://img.shields.io/npm/dm/@cantinc/utils.svg)](https://www.npmtrends.com/@cantinc/utils)
[![changelog](https://img.shields.io/badge/Changelog-⋮-brightgreen)](https://changelogs.xyz/@cantinc/utils)
[![license](https://img.shields.io/npm/l/@cantinc/utils)](https://github.com/cantinc/utils/blob/main/LICENSE)

## Abstract
Here you can find some utils of CANT inc.

[![stars](https://img.shields.io/github/stars/cantinc/utils?style=social)](https://github.com/cantinc/utils/stargazers)
[![watchers](https://img.shields.io/github/watchers/cantinc/utils?style=social)](https://github.com/cantinc/utils/watchers)

## Install
npm
```bash
npm i @cantinc/utils
```
yarn
```bash
yarn add @cantinc/utils
```

## Decorators
Now it supports old way of decorators, to use it with TypeScript flag `experimentalDecorators`

### once
Run getter or method once

```typescript
import { once } from '@cantinc/utils'

let count = 0

class Test {
  @once
  get value () {
    count++
    return 'success'
  }
}

const test = new Test()

console.log(test.value)
// 'success'

console.log(test.value)
// 'success'

console.log(count)
// 1
```

## Validation

The next utils helps validate a data

### Validation

Use `validation` to make validation of an object

```typescript jsx
import {
  email,
  maxLength,
  minLength,
  required,
  validation,
  ValidationMap,
} from '@cantinc/utils'

interface Data {
  email: string
  password: string
  name: string
  birthday?: string
}

const validationMap: ValidationMap<Data> = {
  email: required([email, maxLength(128)]),
  password: required([minLength(9)]),
  name: required([maxLength(128)]),
}

console.log(validation(validationMap, {}))
console.log(validation(validationMap, { email: 'error'}))
```

## Utils

### placeholder

Placeholder inserts data into a string

```typescript
import { placeholder } from '@cantinc/utils'

placeholder(`Test: {test}`, { test: 'success' })
// Test: success
```

## Issues
If you find a bug or have a suggestion, please file an issue on [GitHub](https://github.com/d8corp/innet-utils/issues).

[![issues](https://img.shields.io/github/issues-raw/d8corp/innet-utils)](https://github.com/d8corp/innet-utils/issues)

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