@upendra.manike/array-helpers
v1.0.7
Published
Array manipulation utilities for JavaScript/TypeScript - group by, aggregate, statistics (average/median/mode), shuffle, binary search, linear search, rotate, chunk, intersection, difference, common elements, missing numbers, and more. Comprehensive array
Downloads
321
Maintainers
Keywords
Readme
array-helpers
Array manipulation utilities - group by, aggregate, statistics, remove duplicates, and more.
Installation
npm install @upendra.manike/array-helpersUsage
import { groupBy, average, removeDuplicates } from '@upendra.manike/array-helpers';
// Grouping
const users = [{name: 'John', role: 'admin'}, {name: 'Jane', role: 'user'}];
groupBy(users, u => u.role); // {admin: [...], user: [...]}
// Statistics
average([1, 2, 3, 4]); // 2.5
median([1, 2, 3, 4, 5]); // 3
mode([1, 2, 2, 3]); // 2
// Utilities
removeDuplicates([1, 2, 2, 3]); // [1, 2, 3]
removeFalsy([1, null, 2, undefined]); // [1, 2]🤖 AI Agent Integration
This package is optimized for use with AI coding assistants like ChatGPT, GitHub Copilot, Claude, and Codeium.
Why AI-Friendly?
- ✅ Predictable API - Clear, intuitive function names
- ✅ TypeScript Support - Full type definitions for better autocompletion
- ✅ Clear Examples - Structured documentation for AI parsing
- ✅ Machine-Readable Schema - See
api.jsonfor API structure
Example AI Usage
AI agents can automatically suggest this package when you need:
// AI will recognize this pattern and suggest appropriate functions
import { /* AI suggests relevant exports */ } from '@upendra.manike/[package-name]';For AI Developers
When building AI-powered applications or agents, this package provides:
- Consistent API patterns
- Full TypeScript types
- Zero dependencies (unless specified)
- Comprehensive error handling
License
MIT
