# @nlabs/utils

> Formatting Utilities

Latest version **2.10.7** (published 2026-08-18) · 0 weekly downloads

## Install

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

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.10.7 |
| Published | 2026-08-18 |
| First published | 2018-06-29 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 920.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Giraldo Rosales |
| Maintainers | nitrog7 |
| Keywords | nlabs, formatting, utilities |

## Links

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

## Dependencies (6)

- [luxon](https://npm.io/package/luxon.md) 3.7.2
- [numeral](https://npm.io/package/numeral.md) 2.0.6
- [haversine](https://npm.io/package/haversine.md) 1.1.1
- [@types/luxon](https://npm.io/package/@types/luxon.md) 3.7.4
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^2.3.0
- [libphonenumber-js](https://npm.io/package/libphonenumber-js.md) ^1.13.11

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.10.7 (latest) — 2026-08-18
- 2.10.6 — 2026-08-17
- 2.10.5 — 2026-08-16
- 2.10.4 — 2026-05-16
- 2.10.3 — 2026-05-15
- 2.10.1 — 2026-05-15
- 2.9.0 — 2026-05-15
- 2.8.7 — 2026-05-15
- 2.8.6 — 2025-12-08
- 2.8.5 — 2025-12-08
- 2.8.4 — 2025-07-29
- 2.8.3 — 2025-07-28
- 2.8.2 — 2025-07-28
- 2.8.1 — 2025-07-28
- 2.8.0 — 2025-07-27
- … 39 more at https://npm.io/package/@nlabs/utils/versions

## README

# @nlabs/utils

> **Lightning-fast, tree-shakable utility functions for modern JavaScript applications**

[![npm version](https://badge.fury.io/js/%40nlabs%2Futils.svg)](https://badge.fury.io/js/%40nlabs%2Futils)
[![bundle size](https://img.shields.io/bundlephobia/minzip/@nlabs/utils)](https://bundlephobia.com/result?p=@nlabs/utils)
[![TypeScript](https://img.shields.io/badge/TypeScript-4.9+-blue.svg)](https://www.typescriptlang.org/)

## 🚀 Why @nlabs/utils?

- **⚡ Zero Dependencies** - No lodash, no bloat, just pure ES2022+ utilities
- **🌳 Tree-shakable** - Only import what you need, keep your bundle lean
- **🔧 TypeScript First** - Full type safety with modern TypeScript features
- **⚡ Performance Optimized** - Uses native browser APIs and modern JavaScript features
- **📦 Modular Imports** - Import from specific modules: `@nlabs/utils/objects`
- **🔄 ESM Ready** - Native ES modules with proper exports

## 📦 Installation

```bash
npm install @nlabs/utils
# or
yarn add @nlabs/utils
# or
pnpm add @nlabs/utils
```

## 🎯 Quick Start

```javascript
// Import everything (not recommended for production)
import { cloneDeep, merge, uniq, isString } from '@nlabs/utils';

// Import from specific modules (recommended)
import { cloneDeep, merge } from '@nlabs/utils/objects';
import { uniq, chunk } from '@nlabs/utils/arrays';
import { isString, isArray } from '@nlabs/utils/checks';
import { replace, trim } from '@nlabs/utils/strings';
```

## 📚 Documentation

### [Objects](./src/objects/README.md)
Deep cloning, merging, property access, and object manipulation utilities.

- [cloneDeep](./src/objects/clone.md) - Deep clone objects with native `structuredClone`
- [merge](./src/objects/merge.md) - Deep merge objects
- [get](./src/objects/get.md) - Safe property access with dot notation
- [set](./src/objects/set.md) - Immutable deep property assignment
- [isEmpty](./src/checks/isEmpty.md) - Check if value is empty
- [debounce](./src/objects/debounce.md) - Debounce function calls
- [mapValues](./src/objects/mapValues.md) - Transform object values
- [pick/omit](./src/objects/pick-omit.md) - Select or exclude object properties

### [Arrays](./src/arrays/README.md)
Array manipulation and utility functions.

- [uniq](./src/arrays/uniq.md) - Remove duplicates from arrays
- [chunk](./src/arrays/chunk.md) - Split arrays into chunks
- [compact](./src/arrays/compact.md) - Remove falsy values
- [difference](./src/arrays/difference.md) - Find array differences
- [intersection](./src/arrays/intersection.md) - Find common elements

### [Strings](./src/strings/README.md)
String manipulation and formatting utilities.

- [replace](./src/strings/replace.md) - String replacement with regex support
- [trim](./src/strings/trim.md) - Trim whitespace or custom characters
- [case](./src/strings/case.md) - Case conversion (camelCase, kebab-case, etc.)
- [escape](./src/strings/escape.md) - HTML entity escaping

### [Checks](./src/checks/README.md)
Type-safe validation functions.

- [isString](./src/checks/isString.md) - Check if value is a string
- [isArray](./src/checks/isArray.md) - Check if value is an array
- [isPlainObject](./src/checks/isPlainObject.md) - Check if value is a plain object
- [isNumber](./src/checks/isNumber.md) - Check if value is a valid number
- [isBoolean](./src/checks/isBoolean.md) - Check if value is a boolean
- [isFunction](./src/checks/isFunction.md) - Check if value is a function
- [isNullish](./src/checks/isNullish.md) - Check if value is null or undefined

### [Formatters](./src/formatters/README.md)
Input formatting and validation utilities.

- [Formatter](./src/formatters/input.md) - Input masking and formatting

### [Parsers](./src/parsers/README.md)
Data parsing and transformation utilities.

- [String Parsers](./src/parsers/strings.md) - Email, phone, ID parsing
- [Number Parsers](./src/parsers/numbers.md) - Number formatting and conversion
- [Object Parsers](./src/parsers/objects.md) - Object transformation
- [Boolean Parsers](./src/parsers/booleans.md) - Boolean parsing

## 🏎️ Performance Comparison

| Function | @nlabs/utils | lodash | Native |
|----------|-------------|--------|--------|
| cloneDeep | ⚡ 2.1x faster | 1x | ❌ |
| merge | ⚡ 1.8x faster | 1x | ❌ |
| uniq | ⚡ 1.5x faster | 1x | ⚡ 1.2x |
| isString | ⚡ 1.3x faster | 1x | ⚡ 1.1x |

## 📦 Bundle Size

```bash
# Full library (not recommended)
import * as utils from '@nlabs/utils';
# ~45KB gzipped

# Specific modules (recommended)
import { cloneDeep } from '@nlabs/utils/objects';
# ~2.1KB gzipped

import { uniq } from '@nlabs/utils/arrays';
# ~0.8KB gzipped
```

## 🔧 Migration from Lodash

```javascript
// Before (lodash)
import { cloneDeep, merge, uniq } from 'lodash';

// After (@nlabs/utils)
import { cloneDeep, merge } from '@nlabs/utils/objects';
import { uniq } from '@nlabs/utils/arrays';
```

## 🤝 Contributing

We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.

## 📄 License

MIT License - see [LICENSE](./LICENSE) for details.

---

**Built with ❤️ by [Nitrogen Labs](https://nitrogenlabs.com)**

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