diff options
author | Nicolas Williams <nico@cryptonector.com> | 2013-12-02 12:19:23 -0600 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2013-12-04 18:21:42 -0600 |
commit | b37ce20c2ad9e742cf2a67ab73a1818ad1c9e254 (patch) | |
tree | 6a1ffc049357926988f5443f7776709d7d671e92 /builtin.c | |
parent | cac14a531de733cbffe50eb4e6c479b5ef577e21 (diff) |
Add index and rindex builtins
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -676,6 +676,8 @@ static const char* const jq_builtins[] = { "def from_entries: map({(.key): .value}) | add;", "def with_entries(f): to_entries | map(f) | from_entries;", "def reverse: [.[length - 1 - range(0;length)]];", + "def index(i): .[i][0];", + "def rindex(i): .[i][-1:][0];", }; |