| map(array, fn) | Transforms every item with a function. | map([1, 2, 3], x => x * 2) | [2,4,6] |
| filter(array, fn) | Keeps the items for which the function is truthy. | filter([1, 2, 3, 4], x => x > 2) | [3,4] |
| find(array, fn) | First item for which the function is truthy, or null. | find([1, 2, 3], x => x > 1) | 2 |
| some(array, fn) | True if the function is truthy for at least one item. | some([1, 2, 3], x => x > 2) | true |
| every(array, fn) | True if the function is truthy for every item (true for an empty array). | every([1, 2, 3], x => x > 0) | true |
| first(array) | First item, or null for an empty array. | first([7, 8]) | 7 |
| last(array) | Last item, or null for an empty array. | last([7, 8]) | 8 |
| slice(arrayOrText, start, end = length) | Part of an array or text between two positions; negative positions count from the end. | slice([1, 2, 3, 4], 1, 3) | [2,3] |
| sort(array, keyFn or "asc"/"desc", order = "asc") | Sorts a copy of the array (stable). Give a function to sort by a derived key; nulls sort last. | sort([3, 1, 2]) | [1,2,3] |
| unique(array) | Removes duplicate items, keeping the first of each. | unique([1, 2, 2, 3]) | [1,2,3] |
| flatten(array, depth = 1) | Flattens nested arrays by the given depth. | flatten([[1], [2, [3]]]) | [1,2,[3]] |
| reverse(arrayOrText) | Reverses an array or text (returns a copy). | reverse([1, 2, 3]) | [3,2,1] |
| count(array, fn) | Number of items, or of items for which the function is truthy. | count([1, 2, 3, 4], x => x % 2 == 0) | 2 |
| pluck(array, path) | Reads a property path (like "a.b[0]") from every item. | pluck([{a: 1}, {a: 2}], 'a') | [1,2] |