last
ArrayReturns the last element of an array as a single value. Complement of first. Useful for extracting the most-recent record from an oldest-first API response.
Syntax
lastUse cases
| Use case | Description | URL | |
|---|---|---|---|
| Most recent post | Get the single latest post by taking the last item from an ID-sorted list. | https://httpip.es/api/pipe/fetch:https://jsonplaceholder.typicode.com/posts|sort:id|last|pick:id,userId,title | |
| Last alphabetical repo | Find the repo that sorts last alphabetically in a user's list. | https://httpip.es/api/pipe/fetch:https://api.github.com/users/octocat/repos|sort:name|last|pick:name,stargazers_count | |
| Last element of literal array | Extract the final element from a known array. | https://httpip.es/api/pipe/echo:["alpha","beta","gamma","delta"]|last | |
| Highest-ID todo | Pull the most-recently created todo by extracting the last after sorting by ID. | https://httpip.es/api/pipe/fetch:https://jsonplaceholder.typicode.com/todos|sort:id|last|pick:id,title,completed |