Skip to content

Commit

Permalink
Add slices to table
Browse files Browse the repository at this point in the history
  • Loading branch information
expede committed Aug 6, 2024
1 parent 846779b commit f2d9bd7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,16 @@ Selector syntax is closely based on [jq]'s "filters". They operate on an [Invoca

Selectors MUST only include the following features:

| Selector Name | Examples | Notes |
|---------------------------|----------------------------|-------------------------------------------------------------------------------------------------|
| Identity | `.` | Take the entire argument |
| Dotted field name | `.foo`, `.bar0_` | Shorthand for selecting in a map by key (with exceptions, see below) |
| Unambiguous field name | `["."]`, `["$_*"]` | Select in a map by arbitrary key |
| Collection values | `[]` | Expands out all of the children that match the remaining path FIXME double check with the code |
| Collection index | `[0]`, `[42]` | The element at an index. On a map, this is decided by IPLD's key sort order. FIXME double check |
| Collection negative index | `[-1]`, `[-42]` | The element by index from the end. `-1` is the index for the last element. |
| Try | `.foo?`, `["nope"]?` | Returns `null` on what would otherwise fail |
| Selector Name | Examples | Notes |
|---------------------------|-------------------------------------|-------------------------------------------------------------------------------------------------|
| Identity | `.` | Take the entire argument |
| Dotted field name | `.foo`, `.bar0_` | Shorthand for selecting in a map by key (with exceptions, see below) |
| Unambiguous field name | `["."]`, `["$_*"]` | Select in a map by arbitrary key |
| Collection values | `[]` | Expands out all of the children that match the remaining path FIXME double check with the code |
| Collection index | `[0]`, `[42]` | The element at an index. On a map, this is decided by IPLD's key sort order. FIXME double check |
| Collection negative index | `[-1]`, `[-42]` | The element by index from the end. `-1` is the index for the last element. |
| Collection slices | `[7:11]`, `[2:]`, `[:42]`, `[0:-2]` | The range of elements by their indices. |
| Optional | `.foo?`, `["nope"]?` | Returns `null` on what would otherwise fail |

Any selection MAY begin and/or end with a single dot. Multiple dots (e.g. `..`, `...`) MUST NOT be used anywhere in a selector.

Expand Down

0 comments on commit f2d9bd7

Please sign in to comment.