New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@dependabit/utils

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dependabit/utils

Utility functions for the monorepo

latest
Source
npmnpm
Version
0.1.14
Version published
Maintainers
1
Created
Source

@dependabit/utils

String and array utility functions for the monorepo.

Features

  • String manipulation - capitalize, camelCase, kebabCase, truncate
  • Array operations - unique, groupBy, flatten, chunk
  • Type-safe - Full TypeScript support
  • No dependencies - Pure functional utilities

Installation

pnpm add @dependabit/utils

Usage

String Utilities

import { capitalize, camelCase, kebabCase, truncate } from '@dependabit/utils/string';

capitalize('hello');          // 'Hello'
camelCase('hello-world');     // 'helloWorld'
kebabCase('HelloWorld');      // 'hello-world'
truncate('Hello World', 8);   // 'Hello...'

Array Utilities

import { unique, groupBy, flatten, chunk } from '@dependabit/utils/array';

unique([1, 2, 2, 3]);                      // [1, 2, 3]
groupBy([1, 2, 3], n => n % 2);            // { 0: [2], 1: [1, 3] }
flatten([[1, [2, 3]]], 1);                 // [1, [2, 3]]
chunk([1, 2, 3, 4, 5], 2);                 // [[1, 2], [3, 4], [5]]

Sub-paths

You can import specific modules:

// Import only string utilities
import { capitalize } from '@dependabit/utils/string';

// Import only array utilities
import { unique } from '@dependabit/utils/array';

// Import everything
import { capitalize, unique } from '@dependabit/utils';

API

String Module

  • capitalize(str: string): string - Capitalize first letter
  • camelCase(str: string): string - Convert to camelCase
  • kebabCase(str: string): string - Convert to kebab-case
  • truncate(str: string, maxLength: number, suffix?: string): string - Truncate with suffix

Array Module

  • unique<T>(arr: T[]): T[] - Remove duplicates
  • groupBy<T, K>(arr: T[], keyFn: (item: T) => K): Record<K, T[]> - Group by key
  • flatten<T>(arr: Array<T | T[]>, depth?: number): T[] - Flatten nested arrays
  • chunk<T>(arr: T[], size: number): T[][] - Split into chunks

Testing

# Run tests for this package
pnpm --filter @dependabit/utils test

# Watch mode
pnpm --filter @dependabit/utils test:watch

# Coverage
pnpm --filter @dependabit/utils test:coverage

Performance

All functions are optimized for:

  • Time complexity O(n) or O(n log n)
  • Minimal memory allocations
  • No external dependencies

License

MIT

Keywords

utils

FAQs

Package last updated on 10 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts