## DEV Community ๐ฉโ๐ป๐จโ๐ป is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Lรขm

Posted on

# 101 Cheat Sheet

### Reference

``````isFloat = passAll(isNumber, compose(isInteger, not))
// n => isNumber(n) && not(isInteger(n))
``````
``````function doStuff (object, options) { ... }

doStuffForce = curry(flip(doStuff))({ force: true })
``````

### [Arrays] Grouping

``````groupBy(list, 'id')
indexBy(list, 'id')
``````

### [Arrays] Finding

``````find(list, x => x.y === 2)
findIndex(list, x => ...)
includes(list, 'item')
last(list)
``````
``````find(list, hasProps('id'))
``````

### [Functions] Converge

``````converge(and, [pluck('a'), pluck('b')])(x)
``````
``````// โ and(pluck(x, 'a'), pluck(x, 'b'))
``````

See:
converge

### [Functions] And/or

``````passAll(f, g)       // x => f(x) && g(x)
passAny(f, g)       // x => f(x) || g(x)
``````

See:
passAll,
passAny

### [Functions] Composition

``````compose(f, g)       // x => f(g(x))
curry(f)            // x => y => f(x, y)
flip(f)             // f(x, y) --> f(y, x)
``````

See:
compose,
curry,
flip

### [Functions] Simple functions

| `and(x, y)` | `x && y` |
| `or(x, y)` | `x || y` |
| `xor(x, y)` | `!(!x && !y) && !(x && y)` |
| `equals(x, y)` | `x === y` |
| `exists(x)` | `!!x` |
| `not(x)` | `!x` |

Useful for function composition.

See:
and,
equals,
exists

### [Objects] Get values

``````values(state)
``````

### [Objects] Keypath check

``````hasKeypaths(state, ['user'])