# unmutable

> Immutable.js functions for collections that may or may not be Immutable.

Latest version **0.48.0** (published 2020-06-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install unmutable
pnpm add unmutable
yarn add unmutable
bun add unmutable
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.48.0 |
| Published | 2020-06-22 |
| First published | 2017-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 174.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Damien Clarke |
| Maintainers | dxinteractive |

## Links

- npm: https://www.npmjs.com/package/unmutable
- Repository: https://github.com/92green/unmutable
- Homepage: https://github.com/92green/unmutable#readme
- Issues: https://github.com/92green/unmutable/issues
- npm.io page: https://npm.io/package/unmutable

## Dependencies (4)

- [lodash.range](https://npm.io/package/lodash.range.md) ^3.2.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.1.5
- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^1.0.0
- [is-plain-object](https://npm.io/package/is-plain-object.md) ^2.0.4

## Recent versions

- 0.48.0 (latest) — 2020-06-22
- 0.46.0-alpha.0 (next) — 2019-07-28
- 0.47.2 — 2020-02-13
- 0.47.1 — 2020-01-15
- 0.47.0 — 2019-12-03
- 0.46.1 — 2019-09-19
- 0.46.0 — 2019-08-07
- 1.0.0-alpha.5 — 2019-07-28
- 1.0.0-alpha.4 — 2019-07-28
- 1.0.0-alpha.3 — 2019-07-28
- 1.0.0-alpha.2 — 2019-07-28
- 1.0.0-alpha.1 — 2019-07-28
- 0.45.1 — 2019-04-30
- 0.44.1 — 2019-03-20
- 0.44.0 — 2019-03-03
- … 58 more at https://npm.io/package/unmutable/versions

## README

![unmutable](https://user-images.githubusercontent.com/345320/74409039-fbc99680-4e89-11ea-8d2d-d7ca7bdf1e15.png)

<a href="https://www.npmjs.com/package/unmutable"><img src="https://img.shields.io/npm/v/unmutable.svg?style=flat-square"></a>

An immutable, functional data collection library for plain old Javascript.

It combines my favourite parts of [immutable.js](https://facebook.github.io/immutable-js/), [lodash/fp](https://github.com/lodash/lodash/wiki/FP-Guide) and [ramdajs](https://ramdajs.com/) together.

Unmutable follows [immutable.js](https://facebook.github.io/immutable-js/)'s API almost exactly, and but exports each method individually as a [point-free function](https://en.wikipedia.org/wiki/Tacit_programming), in the same way as [lodash/fp](https://github.com/lodash/lodash/wiki/FP-Guide) does. These functions are all immutable, and can be composed together easily.

Unmutable also works seamlessly on plain Javascript objects and arrays, Immutable.js Maps, Lists and Records. It can also works on your own classes if you make them [unmutable-compatible](#).

## API documentation

**[See the docs](https://92green.github.io/unmutable)**

## Installation

```sh
npm install unmutable
// or
yarn add unmutable
```

Also see [deep-memo](/packages/deep-memo), a library that uses unmutable.

## Usage

*Use it in a pipe!*

```js
var data = [1,2,3];

let result = pipeWith(
    data,
    push(4),
    reverse(),
    map(num => num * 10)
);

// result is [40,30,20,10]
// wow!
```

*Use it partially applied!*

```js
var data = {
    foo: 1,
    bar: null,
    baz: 3
};

var filterNulls = filter((val) => {
    return val === null;
});

let result = filterNulls(data);

// result is {foo: 1, baz: 3}
// golly!
```

*Use it in one line!*

```js
var data = [1,3,3,2,1];

let result = unique()(data);

// result is [1,3,2]
// yee!
```

## Inspiration

Immutable.js has a wonderfully symmetrical and well thought out API, and it deals with data [immutably](https://facebook.github.io/immutable-js/#the-case-for-immutability).
Its a fantastic library, but its drawbacks are that it's large in size and impossible to take only the parts of the API you want, which makes it quite unsuitable for small Javascript libraries. It also requires you use its special data types which can involve a lot of to-ing and fro-ing between normal Javascript types and Immutable.js types.

Ramdajs and Lodash/fp both allow for functions to be composed together *[point-free style](https://en.wikipedia.org/wiki/Tacit_programming)*, which is a really nice way of programming, and it naturally keeps the bundle size small as you only import what you need.
Lodash/fp's main drawback is that its API is large, unwieldy and unpredictable. Ramdajs' API is better planned, but it's overall pretty esoteric and alien to programmers who are not used to fully functional languages.
And both of those libraries use [currying](https://hughfdjackson.com/javascript/why-curry-helps/), which unmutable deliberately avoids*.

<small>Unmutable deliberately avoids currying because currying in Javascript requires functions to have fixed arity, and Unmutable cannot have fixed arity functions because it must match Immutable.js which uses optional arguments / variable arity functions.</small>

## Development

Unmutable is written and maintained by [Damien Clarke](https://damienclarke.me/), with feedback from others at [92green](https://github.com/92green).
All online library discussion happens over on [Github](https://github.com/92green/unmutable).

I hope this library helps solve some Javascript data manipulation problems for you. 🎉

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