Operations1 on Collections with Ramda
| Purpose | List | Object | Signature(s) |
|---|---|---|---|
| update/insert individual | update, assoc*, append, prepend |
assoc* |
Idx → a → {k: v} → {k: v} |
| insert range/collection | concat |
merge* |
[a] → [a] → [a];{k: v} → {k: v} → {k: v} |
| retrieve by key/index | nth, path, prop |
prop, path |
Idx → {a} → a |
| retrieve many by key/index | props |
||
| apply fn to single item | adjust, modify, modifyPath |
modify2 3, modifyPath |
Idx → (v → v) → {k: v} → {k: v} |
| apply fn to all items | map |
map |
(a → b) → [a] → [b]; (a → b) → {k: a} → {k: b} |
| apply each fn to individual | evolve |
evolve3 |
{k: (v → v)} → {k: v} → {k: v} |
| apply each fn to each item | zipWith(call) |
[a → b] → [a] → [b] |
|
| apply each fn to all items | ap |
[a → b] → [a] → [b] |
|
| remove item | slice |
dissoc* |
String → {k: v} → {k: v} |
| remove range/collection | slice, difference, drop* |
omit |
Number → Number → [a] → [a], [a] → [a] → [a], [String] → {k: v} → {k: v} |
| subset by predicate | filter |
filter |
(a → boolean) → [a] → [a]; (a → boolean) → {k: a} → {k: a} |