}
free(keys);
jv_free(input[0]);
+ } else if (jv_get_kind(input[0]) == JV_KIND_ARRAY) {
+ int n = jv_array_length(input[0]);
+ output[0] = jv_array();
+ for (int i=0; i<n; i++){
+ output[0] = jv_array_set(output[0], i, jv_number(i));
+ }
} else {
output[0] = jv_invalid_with_msg(jv_string_fmt("'keys' only supports object, not %s",
jv_kind_name(jv_get_kind(input[0]))));
same for any two objects with the same set of keys,
regardless of locale settings.
+ When `keys` is given an array, it returns the valid indices
+ for that array: the integers from 0 to length-1.
+
examples:
- program: 'keys'
input: '{"abc": 1, "abcd": 2, "Foo": 3}'
output: ['["Foo", "abc", "abcd"]']
+ - program: 'keys'
+ input: '[42,3,35]'
+ output: ['[0,1,2]']
- title: `select`
body: |