# @telegram.ts/collection

> Utility data structure used in telegramsjs

Latest version **2.0.1** (published 2025-12-15) · 0 weekly downloads

## Install

```sh
npm install @telegram.ts/collection
pnpm add @telegram.ts/collection
yarn add @telegram.ts/collection
bun add @telegram.ts/collection
```

## Health

**Score 60/100 (C)** — status: stable.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-12-15 |
| First published | 2024-03-23 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 57.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sempai |
| Maintainers | crazy-sempai07 |
| Keywords | javascript, typescript, collection, library, sempai-07 |

## Links

- npm: https://www.npmjs.com/package/@telegram.ts/collection
- Homepage: https://telegramsjs.vercel.app/
- npm.io page: https://npm.io/package/@telegram.ts/collection

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2025-12-15
- 2.0.0 — 2025-12-14
- 1.1.0 — 2024-05-02
- 1.0.0 — 2024-03-23

## README

# @telegram.ts/collection

[![NPM Version](https://img.shields.io/npm/v/@telegram.ts/collection)](https://www.npmjs.com/package/@telegram.ts/collection)
[![NPM Downloads](https://img.shields.io/npm/dt/@telegram.ts/collection.svg?maxAge=3600)](https://www.npmjs.com/package/@telegram.ts/collection)
[![License](https://img.shields.io/npm/l/@telegram.ts/collection)](https://github.com/telegramsjs/plugins/blob/main/LICENSE)

A powerful Map-based data structure with additional utility methods. This library extends JavaScript's native `Map` with methods inspired by Arrays, making it perfect for managing collections of data with unique identifiers.

## Features

- 🚀 **Extends Native Map** - Full compatibility with JavaScript's Map API
- 📦 **Rich Utility Methods** - 50+ methods for working with collections
- 🎯 **Type-Safe** - Written in TypeScript with full type inference
- ⚡ **Performance Optimized** - Caching and efficient iteration patterns
- 🔗 **Chainable API** - Fluent interface for method chaining
- 🛠️ **Array-like Methods** - Familiar methods like `filter`, `map`, `reduce`, and more

## Installation

```bash
npm install @telegram.ts/collection
```

```bash
yarn add @telegram.ts/collection
```

```bash
pnpm add @telegram.ts/collection
```

## Quick Start

```typescript
import { Collection } from "@telegram.ts/collection";

// Create a collection
const users = new Collection<string, User>();

// Add items
users.set("123", { id: "123", name: "Alice", age: 25 });
users.set("456", { id: "456", name: "Bob", age: 30 });

// Use utility methods
const adults = users.filter((user) => user.age >= 18);
const names = users.map((user) => user.name);
const oldest = users.reduce((prev, curr) =>
  curr.age > prev.age ? curr : prev,
);

// Chain operations
users
  .filter((user) => user.age > 20)
  .each((user) => console.log(user.name))
  .map((user) => user.age);
```

## Credits

This library is inspired by [`@discordjs/collection`](https://github.com/discordjs/discord.js/tree/main/packages/collection) and adapted for telegram.ts use cases.

## LICENSE

This project is licensed under the MIT License - see the [LICENSE](https://github.com/telegramsjs/collection/blob/main/LICENSE) file for details.

## Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please create a `GitHub` issue or submit a pull request. Additionally, feel free to reach out to me on Telegram via my username `@SempaiJS` or on Discord using my username `sempaika_chess`.

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