# @nteract/commutable

> library for immutable notebook operations

Latest version **7.5.1** (published 2023-07-18) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @nteract/commutable
pnpm add @nteract/commutable
yarn add @nteract/commutable
bun add @nteract/commutable
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.5.1 |
| Published | 2023-07-18 |
| First published | 2017-02-09 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 726.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Kyle Kelley |
| Maintainers | benabel, alexandercbooth, benrussert, mpacer, theengineear, yuvipanda, rgbkrk, lgeiger, ivanov, captainsafia, peggyrayzis, jdetle, hasch, willingc, stormpython, crystalline-cat, emeeks, hydrosquall |
| Keywords | commutable, nteract, notebooks |

## Links

- npm: https://www.npmjs.com/package/@nteract/commutable
- npm.io page: https://npm.io/package/@nteract/commutable

## Dependencies (2)

- [uuid](https://npm.io/package/uuid.md) ^8.0.0
- [immutable](https://npm.io/package/immutable.md) ^4.0.0-rc.12

## 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

- 7.5.1 (latest) — 2023-07-18
- 7.4.2-alpha.0 (prerelease) — 2020-12-08
- 7.2.11-alpha.0 (pre) — 2020-04-21
- 7.5.0 — 2022-07-08
- 7.4.6 — 2021-08-30
- 7.4.5 — 2021-06-20
- 1.0.0 — 2021-06-10
- 7.4.4 — 2021-04-30
- 7.4.3 — 2021-02-23
- 7.4.2 — 2021-01-26
- 7.4.1-alpha.0 — 2020-12-08
- 7.4.0 — 2020-12-04
- 7.3.5 — 2020-12-01
- 7.3.4 — 2020-10-26
- 7.3.3 — 2020-09-29
- … 70 more at https://npm.io/package/@nteract/commutable/versions

## README

# @nteract/commutable

Commutable is a package to represent a Jupyter notebook document, as well as
operations on the notebook, as a series of immutable notebooks, each one with
its own state at a point in time.

This package follows the principles below, based on
[Tom MacWright](http://www.macwright.org/2015/05/18/practical-undo.html)'s
outline for practical undo.

- **A notebook document is immutable**. The notebook document's representation
  is never mutated in-place.
- Changes to a notebook document are encapsulated into **operations** that
  take a previous version and return a new version of the notebook without
  modifying the old version.
- History is represented as a **list of states**, with _the past_ on one end, _the
  present_ on the other, and _an index_ that can back up into 'undo states'.
- Modifying a notebook document causes any **future states to be thrown away**.

## Installation

```
$ yarn add @nteract/commutable
```

```
$ npm install --save @nteract/commutable
```

## Usage

The example below shows how we can create an empty Markdown cell in our
nteract notebook application. We use the `emptyMarkdownCell` immutable object
exported from this package to represent a new empty Markdown cell in a
notebook document.

```javascript
import { emptyMarkdownCell } from "@nteract/commutable";

export default () => (
  <MarkdownPreview
    id="a-random-cell-id"
    cell={emptyMarkdownCell}
    editorFocused={false}
  />
);
```

## Documentation

You can view the reference documentation for `@nteract/commutable` in the
[package docs](https://packages.nteract.io/modules/commutable.html).

## Support

If you experience an issue while using this package or have a feature request,
please file an issue on the [issue board](https://github.com/nteract/nteract/issues/new/choose)
and, if possible, add the `pkg:commutable` label.

## License

[BSD-3-Clause](https://choosealicense.com/licenses/bsd-3-clause/)

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