diff options
author | David Tolnay <dtolnay@gmail.com> | 2015-10-17 23:54:07 -0700 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2015-10-17 23:54:07 -0700 |
commit | b80d58e16743bd8b3a750c6a27e8003f33a1e46e (patch) | |
tree | 591bd3881be57eadf334a03e3af0902ffc7bd548 /docs | |
parent | 6c31850e86bfe482bdaff8bc858864be2c7f4c75 (diff) |
Move docs for map earlier (fix #288)
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/3.manual/manual.yml | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml index f7fd9381..df309c4a 100644 --- a/docs/content/3.manual/manual.yml +++ b/docs/content/3.manual/manual.yml @@ -736,6 +736,28 @@ sections: input: '[2, 0]' output: ['[false, true]'] + - title: "`map(x)`, `map_values(x)`" + body: | + + For any filter `x`, `map(x)` will run that filter for each + element of the input array, and produce the outputs a new + array. `map(.+1)` will increment each element of an array of numbers. + + Similarly, `map_values(x)` will run that filter for each element, + but it will return an object when an object is passed. + + `map(x)` is equivalent to `[.[] | x]`. In fact, this is how + it's defined. Similarly, `map_values(x)` is defined as `.[] |= x`. + + examples: + - program: 'map(.+1)' + input: '[1,2,3]' + output: ['[2,3,4]'] + + - program: 'map_values(.+1)' + input: '{"a": 1, "b": 2, "c": 3}' + output: ['{"a": 2, "b": 3, "c": 4}'] + - title: "`path(path_expression)`" body: | @@ -904,28 +926,6 @@ sections: input: 'null' output: ['"{\"file\":\"<top-level>\",\"line\":1}"'] - - title: "`map(x)`, `map_values(x)`" - body: | - - For any filter `x`, `map(x)` will run that filter for each - element of the input array, and produce the outputs a new - array. `map(.+1)` will increment each element of an array of numbers. - - Similarly, `map_values(x)` will run that filter for each element, - but it will return an object when an object is passed. - - `map(x)` is equivalent to `[.[] | x]`. In fact, this is how - it's defined. Similarly, `map_values(x)` is defined as `.[] |= x`. - - examples: - - program: 'map(.+1)' - input: '[1,2,3]' - output: ['[2,3,4]'] - - - program: 'map_values(.+1)' - input: '{"a": 1, "b": 2, "c": 3}' - output: ['{"a": 2, "b": 3, "c": 4}'] - - title: "`paths`, `paths(node_filter)`, `leaf_paths`" body: | |