0a4ebc2eb6
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
927 B
927 B
Hints
General
This exercise will get you to write jq
filters for four tasks.
Because a jq
program is a single expression, those four filters need to be joined with commas.
Use parentheses around the sub-expressions to control the order of operations.
1. Extract the shopping list name
- The file contents can be accessed with the
.
filter. - An object property can be accessed with dot-notation or bracket-notation.
2. Count how many ingredients are needed
- You need to output the length of an array.
3. How much sugar?
- You need to select the ingredient named "sugar".
- You need to access one of its properties.
4. Map the ingredients which can be substituted
- You need to concatenate two arrays.
- You need to select specific elements from the resulting array.
- You need to generate a key:value object for each of these elements.
- You need to merge these objects into a single object.