npm package: @hs/transmute
Description: kind of like lodash but works with Immutable
Author: Colby Rabideau
Latest version: 2.1.1

# @hs/transmute

[![transmute on npm](https://img.shields.io/npm/v/@hs/transmute.svg?style=flat-square)](http://npmjs.com/@hs/transmute)
[![Travis branch](https://img.shields.io/travis/HubSpot/transmute/master.svg?style=flat-square)](https://travis-ci.org/HubSpot/transmute)

`@hs/transmute` provides convenient, composable functions for transforming Arrays, [Immutable.js](http://facebook.github.io/immutable-js/) data structures, and Objects.

## Getting started

Transmute can be installed with `npm` or `yarn`.

    npm install @hs/transmute

```javascript
import { Map } from 'immutable';
import pick from 'transmute/pick';

// returns Map { one => 1, three => 3 }
pick(['one', 'three'], Map({one: 1, two: 2, three: 3}));
```

Most of the function (with the execption of some of the composition functions like `compose` and `pipe`) are [curried](https://www.sitepoint.com/currying-in-functional-javascript/) to facilitate partial application. You might also notice that the argument order is the oposite of you'll find in [other utility libraries](http://underscorejs.org/#pick). Passing the options and then the subject makes currying much more useful.

```javascript
import { Map } from 'immutable';
import pick from 'transmute/pick';

const pickTwo = pick(['two']);
// returns Map { two => 2 }
pickTwo(Map({one: 1, two: 2, three: 3}));
```

`transmute` also includes some helpful composition functions which are powerful when we combine them with curried transforms.

```javascript
import { Map, Set } from 'immutable';
import * as t from 'transmute';

const setOfKeysWithEvenValues = t.pipe(
  t.filter((val) => val % 2 === 0),
  t.keySeq,
  Set
);

// returns Set { 'two', 'four' }
takeEvenValues(Map({one: 1, two: 2, three: 3, four: 4}));
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### always

[src/always.js:13-15](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/always.js#L13-L15 "Source code on GitHub")

Creates a function that always returns `returnValue`.

**Parameters**

-   `returnValue` **T**

**Examples**

```javascript
const alwaysBlue = always('blue');
alwaysBlue() === 'blue';
```

Returns **T**

### bind

[src/bind.js:18-18](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/bind.js#L18-L18 "Source code on GitHub")

Sets a function's `this` context. Similar to `Function.prototype.bind`.

**Parameters**

-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `context` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**

**Examples**

```javascript
bind(console.log, console);
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### both

[src/both.js:29-29](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/both.js#L29-L29 "Source code on GitHub")

Returns `true` if the results of `arg` applied to both `condition1` and
`condition2` are truthy.

**Parameters**

-   `condition1` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `condition2` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

**Examples**

```javascript
const isOneToTen = both(
  n => n >= 1,
  n => n <= 10
);

isOneToTen(3) === true;
isOneToTen(11) === false;
```

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### clear

[src/clear.js:14-14](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/clear.js#L14-L14 "Source code on GitHub")

Returns an empty copy of `subject`.

**Parameters**

-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Collection | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
clear([1, 2, 3]) // returns []
clear(List.of(1, 2, 3)) // returns List []
clear({one: 1, two: 2, three: 3}) // returns {}
```

Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Collection | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

### compose

[src/compose.js:28-31](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/compose.js#L28-L31 "Source code on GitHub")

Create a function that runs operations from right-to-left.

`compose` is _not_ curried.

**Parameters**

-   `operations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)>** any number of unary functions.

**Examples**

```javascript
const doubleAndTakeEvens = pipe(
  filter(n => n % 2 === 0),
  map(n => n * 2)
);

doubleAndTakeEvens(List.of(1, 2, 3))
// returns List [ 2, 4, 6 ]
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### concat
[src/concat.js:18-18](src/concat.js#L18)

Joins two `Iterable.Indexed` objects together.

**Examples**

```javascript
// Arrays
concat(List([3]), List([1, 2])); // Returns List [ 1, 2, 3 ]
const addY = concat(List(['y']);
addY(List(['x'])); // Returns List [ 'x', 'y' ]
```

Returns `Iterable` with the concatenated value. Does not support keyed `Iterable` subjects.

### count

[src/count.js:12-12](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/count.js#L12-L12 "Source code on GitHub")

Returns the number of values in `subject`.

**Parameters**

-   `subject` **TYPE**

**Examples**

```javascript
count(List.of(1, 2, 3)) === 3;
```

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**

### curry

[src/curry.js:14-16](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/curry.js#L14-L16 "Source code on GitHub")

Creates a curried version of `operation`.

**Parameters**

-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

**Examples**

```javascript
const toArray = curry((a, b, c) => [a, b, c]);
const toArrayWith1 = toArray(1);
toArrayWith1(2, 3) === [1, 2, 3];
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### curryN

[src/curryN.js:41-41](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/curryN.js#L41-L41 "Source code on GitHub")

Create a curried version of `operation` that expects `arity` arguments.
Inception-ally, `curryN` is also curried.

**Parameters**

-   `arity` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of arguments the curried function accepts
-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** to curry

**Examples**

```javascript
const toArray = curryN(3)((...args) => [...args]);
toArray(1, 2, 3) === [1, 2, 3];
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### debounce

[src/debounce.js:42-42](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/debounce.js#L42-L42 "Source code on GitHub")

`operation` is called `interval` milliseconds after the most recent call.

**Parameters**

-   `interval` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** of milliseconds
-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

Returns **any** the most recent result of `operation`

### debounceImmediate

[src/debounceImmediate.js:52-52](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/debounceImmediate.js#L52-L52 "Source code on GitHub")

`operation` is called immediately and then `interval` milliseconds after the most
recent call.

**Parameters**

-   `interval` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** of milliseconds
-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

Returns **any** the most recent result of `operation`

### difference

[src/difference.js:24-24](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/difference.js#L24-L24 "Source code on GitHub")

Take the difference between one iterable and another iterable.
Only the elements present in just subject will remain.

**Parameters**

-   `toRemove` **Iterable**
-   `subject` **Iterable**

**Examples**

```javascript
const removeOne = difference(Set.of(1));

removeOne(Set.of(1, 2, 3)) // returns Set { 2, 3 }
```

Returns **Iterable**

### either

[src/either.js:26-26](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/either.js#L26-L26 "Source code on GitHub")

Returns true if the results of `arg` applied to either `first` or `second`
are truthy.

**Parameters**

-   `first` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `second` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **any**

**Examples**

```javascript
const oneOrTwo = either(
  n => n === 1,
  n => n === 2
);

oneOrTwo(1) === true;
oneOrTwo(2) === true;
oneOrTwo(3) === false;
```

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### entrySeq

[src/entrySeq.js:13-13](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/entrySeq.js#L13-L13 "Source code on GitHub")

Get a Seq of the entries (i.e. [key, value] tuples) in `subject`.

**Parameters**

-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
entrySeq(Map({one: 1, two: 2}))
// returns Seq [ ['one', 1], ['two', 2] ]
```

Returns **Seq**

### every

[src/every.js:17-17](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/every.js#L17-L17 "Source code on GitHub")

Returns `true` if **all** items in `subject` match `predicate`.

**Parameters**

-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns `true` if item is a match.
-   `subject` **Iterable**

**Examples**

```javascript
const alwaysBlue = every(v => v === 'blue');

alwaysBlue(List.of('blue', 'blue')) === true;
alwaysBlue(List.of('red', 'blue')) === false;
```

Returns **bool**

### filter

[src/filter.js:25-25](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/filter.js#L25-L25 "Source code on GitHub")

Remove values for which `predicate` returns `false`.

**Parameters**

-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns `true` if a value should be included.
-   `subject` **Iterable** to filter.

**Examples**

```javascript
// returns List [ 2 ]
filter(
  (n) => n % 2 === 0,
  List.of(1, 2, 3)
);
```

_`Record`s have a fixed set of keys, so filter returns a Map instead._

```javascript
// returns Map { 'one' => 1, 'three' => 3 }
filter(
  (n) => n % 2 === 0,
  ThreeRecord({one: 1, two: 2, three: 3})
);
```

Returns **Iterable** without values that didn't match `predicate`.

### filterNot

[src/filterNot.js:22-22](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/filterNot.js#L22-L22 "Source code on GitHub")

Remove values for which `predicate` returns `true`.

**Parameters**

-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns `true` if a value should be excluded.
-   `subject` **Iterable** to filter.

**Examples**

```javascript
// returns List [ 1, 3 ]
filterNot(
  (n) => n % 2 === 0,
  List.of(1, 2, 3)
);
```

Returns **Iterable** without values that matched `predicate`.

### flatten

[src/flatten.js:13-15](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/flatten.js#L13-L15 "Source code on GitHub")

Flattens an iterable as deeply as possible.

**Parameters**

-   `subject` **Iterable**

**Examples**

```javascript
// return List [ 1, 2, 3, 4, 5, 6 ]
flatten(List.of(List.of(1, List.of(2, 3)), List.of(4, 5, 6)));
```

Returns **Iterable**

### flattenN

[src/flattenN.js:16-16](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/flattenN.js#L16-L16 "Source code on GitHub")

Flattens an iterable `depth` levels.

**Parameters**

-   `depth` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
-   `subject` **Iterable**

**Examples**

```javascript
// return List [ 1, List [ 2, 3 ], 4, 5, 6 ]
flattenN(1, List.of(List.of(1, List.of(2, 3)), List.of(4, 5, 6)));
```

Returns **Iterable**

### forEach

[src/forEach.js:22-22](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/forEach.js#L22-L22 "Source code on GitHub")

Executes `effect` for each value in `subject`, then returns `subject`.

**Parameters**

-   `effect` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **TYPE**

**Examples**

```javascript
forEach(
  v => console.log(v),
  Map({ one: 1, two: 2, three: 3 })
);

// prints...
// 1
// 2
// 3
```

Returns **TYPE**

### fromJS

[src/fromJS.js:15-17](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/fromJS.js#L15-L17 "Source code on GitHub")

A version of Immutable.fromJS that drops all but the first argument for
compatibility with other transmute functions like `map`.

**Parameters**

-   `json` **any**

**Examples**

```javascript
fromJS({items: [1, 2, 3]})
// returns Map { items: List [ 1, 2, 3 ] }
```

Returns **Iterable?**

### get

[src/get.js:15-15](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/get.js#L15-L15 "Source code on GitHub")

Retrieve the value at `key` from `subject`.

**Parameters**

-   `key` **any** to lookup in `subject`.
-   `subject` **(Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** in which to look up `key`.

**Examples**

```javascript
// returns 1
get('one', Map({one: 1, two: 2, three: 3}))
```

Returns **any** the value at `key`.

### getIn

[src/getIn.js:23-23](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/getIn.js#L23-L23 "Source code on GitHub")

Retrieve a `keyPath` from a nested Immutable or JS structure.

`getIn` short circuts when it encounters a `null` or `undefined` value.

**Parameters**

-   `keyPath` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
const getFirstName = getIn(['name', 'first']);
const user = UserRecord({
  name: Map({
    first: 'Test',
    last: 'Testerson',
  }),
});
getFirstName(user) === 'Test'
```

Returns **any**

### has

[src/has.js:17-17](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/has.js#L17-L17 "Source code on GitHub")

Returns `true` if `key` exists in `subject`.

**Parameters**

-   `key` **any**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
const hasOne = has('one');

hasOne({one: 1}) === true;
hasOne(Map({two: 2})) === false;
```

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### hasIn

[src/hasIn.js:41-41](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/hasIn.js#L41-L41 "Source code on GitHub")

Returns `true` if `keyPath` is defined in a nested data structure.

`hasIn` short circuts and returns `false` when it encounters a `null` or `undefined` value.

**Parameters**

-   `keyPath` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
const hasFirstName = hasIn(['name', 'first']);
const user = UserRecord({
  name: Map({
    first: 'Test',
    last: 'Testerson',
  }),
});
hasFirstName(user) === true
```

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### identity

[src/identity.js:12-14](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/identity.js#L12-L14 "Source code on GitHub")

Returns it's first argument.

**Parameters**

-   `thing` **any**

**Examples**

```javascript
identity('something') === 'something'
```

Returns **any**

### ifElse

[src/ifElse.js:31-31](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/ifElse.js#L31-L31 "Source code on GitHub")

Applies `affirmative` to `subject` if `predicate(subject)` is truthy.
Otherwise applies `negative` to `subject`.

**Parameters**

-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `affirmative` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `negative` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **any**

**Examples**

```javascript
const incrementAwayFromZero = ifElse(
  n => n >= 0,
  n => n + 1,
  n => n - 1
);

incrementAwayFromZero(1) === 2
incrementAwayFromZero(-1) === -2
```

Returns **any**

### ifThen

[src/ifThen.js:32-32](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/ifThen.js#L32-L32 "Source code on GitHub")

Applies `affirmative` to `subject` if `predicate(subject)` is truthy.
Otherwise returns `subject`.

**Parameters**

-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `affirmative` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **any**

**Examples**

```javascript
import ifThen from 'transmute/ifThen';

const toJS = ifThen(
  subject => typeof subject.toJS === 'function',
  subject => subject.toJS
);

toJS(List.of(1, 2, 3)) //=> [1, 2, 3]
toJS([1, 2, 3]) //=> [1, 2, 3]
```

Returns **any**

### indexBy

[src/indexBy.js:27-27](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/indexBy.js#L27-L27 "Source code on GitHub")

Create a Map, or OrderedMap from `subject` with a key for each item
returned by `keyMapper`.

**Parameters**

-   `keyMapper` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** generates keys for each item
-   `subject` **Iterable** to index

**Examples**

```javascript
indexBy(get('id'), List.of({id: 123}, {id: 456}))
// returns Map { 123: {id: 123}, 456: {id: 456} }
```

Returns **KeyedIterable**

### keySeq

[src/keySeq.js:13-13](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/keySeq.js#L13-L13 "Source code on GitHub")

Get a Seq of the keys in `subject`.

**Parameters**

-   `subject` **(Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))**

**Examples**

```javascript
keySeq({one: 1, two: 2, three: 3})
// returns Seq [ 'one', 'two', 'three' ]
```

Returns **Seq**

### map

[src/map.js:18-18](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/map.js#L18-L18 "Source code on GitHub")

Create a new Iterable by applying `mapper` to each item in `subject`.

**Parameters**

-   `mapper` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** applied to each item in `subject`.
-   `subject` **Iterable** the Iterable to map.

**Examples**

```javascript
// returns List [ 2, 3, 4 ]
map(
  (val) => val + 1,
  List.of(1, 2, 3)
);
```

Returns **Iterable** with each value of `subject` updated with mapper.

### reduce

[src/reduce.js:21-21](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/reduce.js#L21-L21 "Source code on GitHub")

Transform the contents of `subject` to `into` by applying `operation` to each
item.

**Parameters**

-   `into` **any**
-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **Iterable** [description]

**Examples**

```javascript
reduce(
  List(),
  (acc, val) => acc.push(val),
  Map({ one: 1, two: 2, three: 3 })
);
// returns List [ 1, 2, 3 ]
```

Returns **Iterable**

### set

[src/set.js:16-16](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/set.js#L16-L16 "Source code on GitHub")

Returns a copy of `subject` with `key` set to `value`.

**Parameters**

-   `key` **any**
-   `value` **any**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
set('one', 2, {one: 1});
// returns {one: 2}
```

Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

### some

[src/some.js:17-17](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/some.js#L17-L17 "Source code on GitHub")

Returns `true` if **any** items in `subject` match `predicate`.

**Parameters**

-   `predicate` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns `true` if item is a match.
-   `subject` **Iterable**

**Examples**

```javascript
const anyBlue = some(v => v === 'blue');

anyBlue(List.of('blue', 'red')) === true;
anyBlue(List.of('red', 'red')) === true;
```

Returns **bool**

### sortBy

[src/sortBy.js:25-25](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/sortBy.js#L25-L25 "Source code on GitHub")

Sort `subject` according to the value returned by `getSortValue`.

**Parameters**

-   `getSortValue` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns a value to sort on for each item in `subject`.
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** the thing to sort.

**Examples**

```javascript
// returns List [ 2, 1, 3 ]
sortBy(
  (n) => n % 2,
  List.of(1, 2, 3)
);
```

```javascript
// returns OrderedMap { "one" => 1, "two" => 2, "three" => 3 }
sortBy(
  (n) => n % 2,
  Map({three: 3, one: 1, two: 2})
);
```

Returns **Iterable** an ordered version of `subject` (e.g. sorting a `Map` returns an `OrderedMap`).

### valueSeq

[src/valueSeq.js:13-13](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/valueSeq.js#L13-L13 "Source code on GitHub")

Get a Seq of the values in `subject`.

**Parameters**

-   `subject` **(Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))**

**Examples**

```javascript
valueSeq(Map({ one: 1, two: 2, three: 3 }))
// returns Seq [ 1, 2, 3 ]
```

Returns **Seq**

### isArray

[src/isArray.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isArray.js#L9-L11 "Source code on GitHub")

Returns `true` if value is an Array.

**Parameters**

-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isEmpty

[src/isEmpty.js:11-16](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isEmpty.js#L11-L16 "Source code on GitHub")

Returns true if `value` is "empty".
If given null, undefined, isEmpty will return true.

**Parameters**

-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isFunction

[src/isFunction.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isFunction.js#L9-L11 "Source code on GitHub")

Returns true if `value` is a Function.

**Parameters**

-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isInstanceOf

[src/isInstanceOf.js:14-14](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isInstanceOf.js#L14-L14 "Source code on GitHub")

Returns true if `value` is an instance of `Constructor`.

**Parameters**

-   `Constructor` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isNull

[src/isNull.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isNull.js#L9-L11 "Source code on GitHub")

Returns `true` if `subject` is `null`.

**Parameters**

-   `subject` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isNumber

[src/isNumber.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isNumber.js#L9-L11 "Source code on GitHub")

Returns `true` if `subject` is a JavaScript Number and not `NaN`.

**Parameters**

-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isObject

[src/isObject.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isObject.js#L9-L11 "Source code on GitHub")

Returns true if `value` is an Object.

**Parameters**

-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isRecord

[src/isRecord.js:10-14](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isRecord.js#L10-L14 "Source code on GitHub")

Returns `true` if `subject` is an instance of a Record.

**Parameters**

-   `subject` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isString

[src/isString.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isString.js#L9-L11 "Source code on GitHub")

Returns true if `value` is a String.

**Parameters**

-   `value` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### isUndefined

[src/isUndefined.js:9-11](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/isUndefined.js#L9-L11 "Source code on GitHub")

Returns `true` if `subject` is `undefined`.

**Parameters**

-   `subject` **any**

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### mapKeys

[src/mapKeys.js:37-37](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/mapKeys.js#L37-L37 "Source code on GitHub")

Like `map` but transforms an Iterable's keys rather than its values.

**Parameters**

-   `keyMapper` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns a new key
-   `subject` **KeyedIterable**

**Examples**

_Can be useful for converting keys of API results to a common type._

```javascript
import { mapKeys, toString } from 'transmute';
const stringifyKeys = mapKeys(toString);
const m = Map.of(123, Map(), 456, Map(), 789, Map());
stringifyKeys(m).equals(Map.of('123', Map(), '456', Map(), '789', Map()));
```

Returns **KeyedIterable**

### match

[src/match.js:25-25](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/match.js#L25-L25 "Source code on GitHub")

Returns `true` if the key => value pairs in `pattern` match the correspoding key => value pairs in `subject`.

**Parameters**

-   `pattern` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
const hasOneAndThree = match({one: 1, three: 3});
hasOneAndThree(Map({one: 1, two: 2, three: 3})) === true;
```

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

### memoize

[src/memoize.js:54-61](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/memoize.js#L54-L61 "Source code on GitHub")

Memoizer that uses a `Map` to allow for arbitrarily many/complex keys.

**Parameters**

-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** to memoize.
-   `hashFunction` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** that generates the cache key. (optional, default `defaultHashFunction`)

**Examples**

```javascript
const sum = memoize((list) => {
  return list.reduce((total, n) => total + n, 0);
});
// does work and returns 15
sum(List.of(1, 2, 3, 4, 5))
// returns 15 but does no work
sum(List.of(1, 2, 3, 4, 5))
```

_We can use the `hashFunction` param to customize the key used in the cache._

```javascript
const sum = memoize(
  (list) => list.reduce((total, n) => total + n, 0),
  (list) => return list.join('-')
);
```

_It's also possible to inspect the state of an instance by reading the `.cache` property._

```javascript
const sum = memoize(...);
Map.isMap(sum.cache) === true;
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** memoized version of `operation`.

### memoizeLast

[src/memoizeLast.js:21-44](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/memoizeLast.js#L21-L44 "Source code on GitHub")

Like memoize, but only caches the most recent value.
It's often useful for caching expensive calculations in react components.

**Parameters**

-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

**Examples**

```javascript
const sum = memoizeLast((...nums) => nums.reduce((acc, n) => acc + n));
sum(List.of(1, 2, 3))
//> does work, returns 6
sum(List.of(1, 2, 3))
//> takes cached value, returns 6
sum(List.of(4, 5, 6))
//> does work, returns 15
sum(List.of(1, 2, 3))
//> does work again, returns 6
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### merge

[src/merge.js:23-23](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/merge.js#L23-L23 "Source code on GitHub")

Takes each entry of `updates` and sets it on `subject`.

**Parameters**

-   `updates` **Iterable** key-value pairs to merge in `subject`.
-   `subject` **Iterable** the thing to update.

**Examples**

```javascript
// returns Map { "one" => 3, "two" => 2, "three" => 1}
merge(
  Map({one: 1, two: 2, three: 3}),
  Map({one: 3, three: 1})
);
```

Returns **Iterable** with each key-value of `updates` merged into `subject`.

### omit

[src/omit.js:24-24](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/omit.js#L24-L24 "Source code on GitHub")

Drop specified keys from a KeyedIterable (e.g. a `Map` or `OrderedMap`).

**Parameters**

-   `keys` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** to remove.
-   `subject` **KeyedIterable** from which to remove `keys`.

**Examples**

```javascript
// returns Map { "two" => 2 }
omit(
  ['one', 'three'],
  Map({one: 1, two: 2, three: 3})
);
```

Returns **KeyedIterable** without `keys`.

### once

[src/once.js:7-17](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/once.js#L7-L17 "Source code on GitHub")

`fn` is only run one time.

**Parameters**

-   `fn` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

Returns **any** the result of the first time `fn` was called

### partial

[src/partial.js:17-20](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/partial.js#L17-L20 "Source code on GitHub")

Like `fn.bind()`, but without the option to pass `context`.

`partial` is _not_ curried.

const add = (a, b, c) => a + b + c;
const add11 = partial(add, 5, 6);
add11(7); // returns 18

**Parameters**

-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the function to bind.
-   `first` **any** the first argument to pass to `operation`
-   `args` **...any**

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### partialApply

[src/partialApply.js:34-34](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/partialApply.js#L34-L34 "Source code on GitHub")

Like `transmute/partial`, but takes an Array or Iterable of arguments to pass
to `operation` rather than a dynamic number of args. Unlike `partial` it is
curried.

partial : partialApply :: Function.prototype.call : Function.prototype.apply

**Parameters**

-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the function to bind.
-   `args` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable)** ordered collection of arguments to bind to `fn`.

**Examples**

```javascript
const add = (a, b, c) => a + b + c;
const add11 = partialApply(add, [5, 6]);
add11(7); // returns 18
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### pick

[src/pick.js:24-24](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/pick.js#L24-L24 "Source code on GitHub")

Select specified keys from a KeyedIterable (e.g. a `Map` or `OrderedMap`).

**Parameters**

-   `keys` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** to select.
-   `subject` **KeyedIterable** from which to select `keys`.

**Examples**

```javascript
// returns Map { "one" => 1, "three" => 3 }
pick(
  ['one', 'three'],
  Map({one: 1, two: 2, three: 3})
);
```

Returns **KeyedIterable** with just `keys`.

### pipe

[src/pipe.js:28-31](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/pipe.js#L28-L31 "Source code on GitHub")

Create a function that runs operations from left-to-right.

`pipe` is _not_ curried.

**Parameters**

-   `operations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)>** any number of unary functions.

**Examples**

```javascript
const takeEvensAndDouble = pipe(
  filter(n => n % 2 === 0),
  map(n => n * 2)
);

takeEvensAndDouble(List.of(1, 2, 3))
// returns List [ 4 ]
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### pluck

[src/pluck.js:20-20](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/pluck.js#L20-L20 "Source code on GitHub")

Select `key` from each item in `subject`.

**Parameters**

-   `key` **any**
-   `subject` **Iterable**

**Examples**

```javascript
const pluckName = pluck('name');
pluckName(userMap) === Map({123: 'Testing'});
```

Returns **Iterable**

### setArity

[src/setArity.js:18-18](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/setArity.js#L18-L18 "Source code on GitHub")

Creates a function identical to `operation` but with length `arity`.

**Parameters**

-   `arity` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** from 0 to 9
-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

**Examples**

```javascript
const op = (...args) => args;
op.length === 0;

const twoArgOp = setArity(2, op);
twoArgOp.length === 2;
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

### setIn

[src/setIn.js:23-23](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/setIn.js#L23-L23 "Source code on GitHub")

Set the `value` at `keyPath` in a nested structure.

**Parameters**

-   `keyPath` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any> | Iterable&lt;any>)**
-   `value` **any**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
setIn(['one', 'two'], 3, {one: {two: 2}});
// returns {one: {two: 3}}
```

_Unset keyPaths will be set based on the most recent type._

```javascript
setIn(['one', 'two'], 3, {});
// returns {one: {two: 3}}

setIn(['one', 'two'], 3, Map());
// returns Map { one => Map { two => 3 } }
```

### throttle

[src/throttle.js:47-47](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/throttle.js#L47-L47 "Source code on GitHub")

Ensures `operation` is only called once every `interval` milliseconds.

**Parameters**

-   `interval` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** of milliseconds
-   `operation` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**

Returns **any** the most recent result of `operation`

### toJS

[src/toJS.js:7-18](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/toJS.js#L7-L18 "Source code on GitHub")

Converts an Iterable to a native JS structure.

**Parameters**

-   `subject` **Iterable** to convert.

Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** native JS requivalent of `subject`.

### toSeq

[src/toSeq.js:11-15](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/toSeq.js#L11-L15 "Source code on GitHub")

Converts `subject` to a `Seq` if possible.

**Parameters**

-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))**

Returns **Seq**

### toString

[src/toString.js:6-8](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/toString.js#L6-L8 "Source code on GitHub")

Returns the value converted to a string.

**Parameters**

-   `value` **any**

### uniqueId

[src/uniqueId.js:12-14](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/uniqueId.js#L12-L14 "Source code on GitHub")

Returns a unique integer string appended to `prefix`.

**Parameters**

-   `prefix` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**  (optional, default `''`)

**Examples**

```javascript
uniqueId('test-') === 'test-1';
uniqueId('other-') === 'other-2';
uniqueId('test-') === 'test-3';
```

### update

[src/update.js:23-23](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/update.js#L23-L23 "Source code on GitHub")

Sets the value at `key` to the result of `updater`.

**Parameters**

-   `key` **any**
-   `updater` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

**Examples**

```javascript
const incrementCount = update('count', n => n + 1);
incrementCount({count: 1});
// returns {count: 2}
```

Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

### updateIn

[src/updateIn.js:31-31](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/updateIn.js#L31-L31 "Source code on GitHub")

Apply `updater` to the value at `keyPath`.

**Parameters**

-   `keyPath` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any> | Iterable&lt;any>)** the location where `updater` should be applied.
-   `updater` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the tranformation to apply.
-   `subject` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** the thing to update.

**Examples**

```javascript
const incrementUserCount = updateIn(['users', 'count'], n => n + 1);
incrementUserCount({users: {count: 1}});
// returns {users: {count: 2}}
```

_Unset keyPaths will be set based on the most recent type._

```javascript
const incrementUserCount = updateIn(['users', 'count'], (n = 0) => n + 1);
incrementUserCount({});
// returns {users: {count: 1}}

incrementUserCount(Map());
// returns Map { users => Map { count => 1 } }
```

Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | Iterable | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))**

### where

[src/where.js:25-25](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/where.js#L25-L25 "Source code on GitHub")

Takes items in `subject` that match `pattern`.

**Parameters**

-   `pattern` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
-   `subject` **Iterable**

**Examples**

```javascript
const users = Map({
  123: {id: '123', name: 'Jack'},
  456: {id: '456', name: 'Jill'},
});

where({name: 'Jack'}, users);
// returns Map { 123: {id: '123', name: 'Jack'} }
```

Returns **Iterable**

### without

[src/without.js:23-23](https://github.com/HubSpot/transmute/blob/ddf170dd577610935b648d330255d9ceccfe75b2/src/without.js#L23-L23 "Source code on GitHub")

Removes values in `unwanted` from `subject`.

**Parameters**

-   `unwanted` **Iterable**
-   `subject` **Iterable**

**Examples**

```javascript
const removeOne = without(Set.of(1));

removeOne(Set.of(1, 2, 3)) // returns Set { 2, 3 }
```

Returns **Iterable**