# @swim/collections

> Immutable, structure sharing collections, including B-trees and S-trees (sequence trees)

Latest version **4.0.0** (published 2024-06-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @swim/collections
pnpm add @swim/collections
yarn add @swim/collections
bun add @swim/collections
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2024-06-09 |
| First published | 2019-02-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 364.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Chris Sachs |
| Maintainers | cwjames19, ajay-gov, c9r |
| Keywords | collections, immutable, trie |

## Links

- npm: https://www.npmjs.com/package/@swim/collections
- Repository: https://github.com/swimos/swim-js
- Homepage: https://github.com/swimos/swim-js/tree/main/swim-core/swim-collections
- Issues: https://github.com/swimos/swim-js/issues
- npm.io page: https://npm.io/package/@swim/collections

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) >= 2.5
- [@swim/util](https://npm.io/package/@swim/util.md) 4.0.0
- [@swim/codec](https://npm.io/package/@swim/codec.md) 4.0.0

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2024-06-09
- 4.0.0-dev.20240413 (dev) — 2024-04-13
- 4.0.0-dev.20210927.3 — 2024-04-04
- 4.0.0-dev.20230923 — 2023-09-23
- 4.0.0-dev.20220527.3 — 2022-05-27
- 4.0.0-dev.20220527.2 — 2022-05-27
- 4.0.0-dev.20220527.1 — 2022-05-27
- 4.0.0-dev.20220527 — 2022-05-27
- 4.0.0-dev.20210927.2 — 2021-11-11
- 4.0.0-dev.20210927.1 — 2021-09-27
- 4.0.0-dev.20210927 — 2021-09-27
- 4.0.0-dev.20210923 — 2021-09-23
- 4.0.0-dev.20210920 — 2021-09-20
- 4.0.0-dev.20210826 — 2021-08-26
- 3.11.1 — 2021-08-17
- … 21 more at https://npm.io/package/@swim/collections/versions

## README

# [![Swim](https://docs.swimos.org/readme/breach-marlin-blue-wide.svg)](https://www.swimos.org) Swim Collections Library

The Swim Collections library implements immutable, structure sharing
collections, including B-trees and S-trees (sequence trees).

## Overview

### B-trees

The `BTree` class implements the `OrderedMap` interface from **@swim/util**,
and compares keys using `Objects.compare`, also from **@swim/util**. `BTree`
is internally immutable, enabling lightweight snapshotting via `BTree.clone`,
and non-destructive mutation via `BTree.updated`, and `BTree.removed`.

`BTree` also implements the `ReducedMap` interface from **@swim/util**,
providing storage of sub-tree reductions in b-tree nodes to support log
time recomputation of whole tree reductions after incremental updates.

### S-trees

The `STree` class implements a sequential list data type that's backed by an
implicitly indexed b-tree. Like `BTree`, `STree` supports lightweight
snapshotting via `STree.clone`.

`STree` associated a unique ID with each list item, which can be used to
reconcile concurrent, conflicting updates to the same logical list.

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