# @esfx/collection-core

> A low-level Symbol-based API for defining common collection behaviors.

Latest version **1.0.0** (published 2022-10-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @esfx/collection-core
pnpm add @esfx/collection-core
yarn add @esfx/collection-core
bun add @esfx/collection-core
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-10-20 |
| First published | 2019-05-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 123.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 234 |
| Author | Ron Buckton |
| Maintainers | rbuckton |

## Links

- npm: https://www.npmjs.com/package/@esfx/collection-core
- Repository: https://github.com/esfx/esfx
- Homepage: https://github.com/esfx/esfx#readme
- Issues: https://github.com/esfx/esfx/issues
- npm.io page: https://npm.io/package/@esfx/collection-core

## Recent versions

- 1.0.0 (latest) — 2022-10-20
- 1.1.0-alpha.202307260322 (next) — 2023-07-26
- 1.0.0-dev.8 (dev) — 2022-10-20
- 1.1.0-alpha.202306080253 — 2023-06-08
- 1.1.0-alpha.202306061406 — 2023-06-06
- 1.1.0-alpha.202306061316 — 2023-06-06
- 1.1.0-alpha.202306051228 — 2023-06-05
- 1.1.0-alpha.202305082104 — 2023-05-08
- 1.1.0-alpha.202302091715 — 2023-02-09
- 1.1.0-alpha.202302071935 — 2023-02-07
- 1.1.0-alpha.202211291446 — 2022-11-29
- 1.1.0-alpha.202211221509 — 2022-11-22
- 1.1.0-alpha.202210252139 — 2022-10-25
- 1.0.0-dev.7 — 2022-10-20
- 1.0.0-dev.6 — 2022-10-19
- … 36 more at https://npm.io/package/@esfx/collection-core/versions

## README

# `@esfx/collection-core`

The `@esfx/collection-core` package provides a low-level Symbol-based API for defining common collection behaviors.

# Overview

* [Installation](#installation)
* [Usage](#usage)
* [API](#api)

# Installation

```sh
npm i @esfx/collection-core
```

# Usage

```ts
import { Collection } from "@esfx/collection-core";

class MyCollection {
    constructor() {
        this._items = new Set();
    }

    // Your implementation
    get count() { return this._items.size; }
    contains(value) { return this._items.has(value); }
    add(value) { this._items.add(value); }
    remove(value) { return this._items.delete(value); }
    clear() { this._items.clear(); }

    // Implement the `Collection` interface for cross-library consistency
    get [Collection.size]() { return this.count; }
    [Collection.has](value) { return this.contains(value); }
    [Collection.add](value) { this.add(value); }
    [Collection.delete](value) { return this.remove(value); }
    [Collection.clear]() { this.clear(); }
    [Symbol.iterator]() { return this._items.values(); }
}
```

# API

You can read more about the API [here](https://esfx.js.org/esfx/api/collection-core.html).

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