# @augu/collections 中文文档

规范地址：https://npmcn.com/package/%40augu/collections/

版本：1\.1\.0
npm 元数据更新时间：2022-04-04T16:23:35.260Z
中文译文更新时间：2026-11-07T04:44:02.391Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40augu/collections
原文对照：https://npmcn.com/package/%40augu/collections/?lang=original
项目主页：https://collections.floofy.dev/
源码仓库：https://github.com/Noelware/collections

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：34.2 kB，7 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=10
- 运行依赖：0 个
- 首次发布：2020-12-30T21:29:08.354Z
- 最新版本发布：2021-09-12T04:14:50.094Z
- 近 30 天下载量：9398（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：14（近 12 个月 0 个）

## 中文简介

以 TypeScript 制作的收藏库

## 安装

```sh
npm install @augu/collections
```

也可以使用：`pnpm add @augu/collections`、`yarn add @augu/collections`、`bun add @augu/collections`

## README

# @augu/ 收藏 ~ [![npm version](https://badge.fury.io/js/%40augu%2Fcollections.svg)](https://badge.fury.io/js/%40augu%2Fcollections) [![Stars](https://img.shields.io/github/stars/auguwu/collections)](https://github.com/auguwu/collections) [![Workflow Status](https://github.com/auguwu/collections/workflows/ESLint/badge.svg)](https://github.com/auguwu/collections/tree/master/.github/workflows) [![Build Status](https://travis-ci.org/auguwu/collections.svg?branch=master)](https://travis-ci.org/auguwu/collections) [![Build Size](https://img.shields.io/bundlephobia/min/@augu/collections?style=flat-square)](https://github.com/auguwu/collections)

> 📝 **以 TypeScript 制作的收藏库**

## 0.x 构建

如果您想要使用 0.x 构建或查看它的源代码,将在 [0.x (中文(简体) )](https://github.com/auguwu/collections/tree/0.x) 树枝,你可以这样做 `npm i @augu/immutable`。 。 。 .

### 从0.x - > 1.x起的变化

-   `Pair` 财务报告和审定财务报表 `TimedQueue` 被重新删除
-   所有贬值方法被删除
-   名称从 `@augu/immutable` 改为 `@augu/collections`

## 使用量

```js
// CommonJS
const collections = require('@augu/collections');

// ES6+
import collections from '@augu/collections';

// Collection: Key-value pair that is an extension of [Map]
const coll = new collections.Collection(); // Create a empty one
const coll = new collections.Collection({
  // Create one with key-value pairs
  key: 'value',
  [Symbol('key')]: 'value',
});

coll.get('key'); // the value if added or undefined
coll.set('key', 'value'); // the value if the key isn't added

coll.filter((value) => value === 'value'); // Returns a Array of values if the predicate is true
coll.map((v) => v); // Returns a Array of values that are mapped by it's predicate function
coll.reduce((curr, acc) => curr + acc, 0); // Implementation of Array.reduce
coll.sort((a, b) => a - b); // Implementation of Array.sort

// Queue: Queue-based system with a timer extension to do time-based queues
const queue = new collections.Queue(); // Create a empty Queue
const queue = new collections.Queue(['a', 'b', 'c']); // Create one with values being added

queue.get(0); // Get a item from it's index
queue.add('c'); // Add a item to the queue
queue.delete(2); // Delete a item from it's index
queue.filter((c) => c === 'a'); // Filter out the queue from a predicate function
queue.map((u) => u); // Map out anything from a predicate function
```

## 维护者

-   [8月(半天)](https://floofy.dev/)

## 许可证

**@ augu/ 收藏** 以 [麻省理工学院](https://npmcn.com/LICENSE)。 。 。

## 常见问题

### @augu/collections 是什么？

以 TypeScript 制作的收藏库

### 如何安装 @augu/collections？

在项目目录运行 npm install @augu/collections，或使用 pnpm add / yarn add / bun add。

### @augu/collections 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @augu/collections 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @augu/collections 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=10。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @augu/collections 可以商用吗？

@augu/collections 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @augu/collections 的下载量有多少？

根据 npm 官方下载统计，@augu/collections 在 2026/10/07 – 2026/11/05 这 30 天内被下载 9,398 次，日均约 313 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @augu/collections 还在维护吗？

最新版本 1\.1\.0 发布于 2021/09/12（5 年前）；至今共发布 14 个版本，其中过去 12 个月发布了 0 个；首次发布于 2020/12/31。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

