# immutable-ext

> fantasyland compatible extensions

Latest version **1.1.5** (published 2018-03-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install immutable-ext
pnpm add immutable-ext
yarn add immutable-ext
bun add immutable-ext
```

## Health

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

Positive: no vulnerabilities; popular repo.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2018-03-16 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.2.0 |
| Dependencies | 0 |
| Unpacked size | 154.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17619 |
| Author | drboolean |
| Maintainers | drboolean |
| Keywords | functional, immutable, monoid, monad, applicative, traversable |

## Links

- npm: https://www.npmjs.com/package/immutable-ext
- Repository: https://github.com/npm/npm
- Homepage: https://github.com/npm/npm#readme
- Issues: https://github.com/npm/npm/issues
- npm.io page: https://npm.io/package/immutable-ext

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2018-03-16
- 1.1.4 — 2018-03-16
- 1.1.3 — 2018-03-16
- 1.1.2 — 2017-07-20
- 1.1.1 — 2017-06-30
- 1.1.0 — 2017-06-12
- 1.0.8 — 2016-12-10
- 1.0.7 — 2016-12-10
- 1.0.6 — 2016-12-04
- 1.0.5 — 2016-10-13
- 1.0.4 — 2016-10-12
- 1.0.3 — 2016-06-17
- 1.0.2 — 2016-03-26
- 1.0.1 — 2016-03-26
- 1.0.0 — 2016-03-25

## README

# immutable-ext
fantasyland extensions for immutablejs

# Install
`npm install immutable-ext`


# What is this?

In addition to the Functor, Foldable, and Monad functions, we now have:
 * Monoid
 * Applicative (list only right now)
 * Traversable

Plus stuff that builds off of reduce like `foldMap`. Please contribute/complain as you want/need things.

## Examples

We can now traverse without messing with Array or Object:

```js
  const { List, Map } = require('immutable-ext')
  const Task = require('data.task')
  const IO = require('fantasy-io')


  // Given Http.get :: String -> Task Error Blog

  List.of('/blog/1', '/blog/2')
    .traverse(Task.of, Http.get)
    .fork(console.error, console.log)
  // List(Blog, Blog)


  Map({home: "<div>homepage</div>", faq: "<p>ask me anything</p>"})
    .traverse(IO.of, (v, k) => new IO(v => $('body').append(v)))

  // IO(Map({home: "[dom]", faq: "[dom]"})
```

We can `fold` stuff down

```js
const {Disjunction, Additive} = require('fantasy-monoids')

List.of([1,2,3], [4,5,6]).fold([])
//[1,2,3,4,5,6]

Map({a: "hidy", b: "hidy", c: "ho"}).fold("")
// "hidyhidyho"


List.of(Map({a: Additive(1), b: Disjunction(true), c: "son", d: [1], e: 'wut'}),
        Map({a: Additive(2), b: Disjunction(false), c: "ofa", d: [2]}),
        Map({a: Additive(3), b: Disjunction(false), c: "gun", d: [3]})).fold(Map.empty),

// Map({a: Additive(6), b: Disjunction(true), c: "sonofagun", d: [1,2,3], e: 'wut'})))
```

`foldMap` some things

```js
List.of(1,2,3,4).foldMap(Additive, Additive.empty)
// Additive(10)

Map({a: true, b: false}).foldMap(Disjunction, Disjunction.empty)
// Disjunction(true)
```

We can `ap` to get us some list comprehensions

```js
List.of(x => y => x + y)
    .ap(List.of('a', 'b', 'c'))
    .ap(List.of('+', '-'))

// List('a+', 'a-', 'b+', 'b-', 'c+', 'c-')
```

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