globals/Array.prototype
Mocks of the helper methods Obsidian adds to Array.prototype, each called with the array as this.
Functions
Section titled “Functions”| Function | Description |
|---|---|
| contains | Checks whether the array includes a value, like Array.prototype.includes. |
| findLastIndex | Finds the index of the last element matching a predicate, scanning from the end. |
| first | Gets the array’s first element. |
| last | Gets the array’s last element. |
| remove | Removes the first occurrence of a value from the array in place; does nothing when it is absent. |
| shuffle | Shuffles the array in place. Obsidian shuffles randomly; the mock reverses the array instead, so tests stay deterministic. |
| unique | Collects the array’s distinct values, keeping the order of their first occurrence. |