Debian Codegraph @

doc/_includes/examples/cocktail-comprehensions.jsonnet

raw
1 {
2 cocktails: {
3 "Bee's Knees": {
4 // Construct the ingredients by using
5 // 4/3 oz of each element in the given
6 // list.
7 ingredients: [ // Array comprehension.
8 { kind: kind, qty: 4 / 3 }
9 for kind in [
10 'Honey Syrup',
11 'Lemon Juice',
12 'Farmers Gin',
13 ]
14 ],
15 garnish: 'Lemon Twist',
16 served: 'Straight Up',
17 },
18 } + { // Object comprehension.
19 [sd.name + 'Screwdriver']: {
20 ingredients: [
21 { kind: 'Vodka', qty: 1.5 },
22 { kind: sd.fruit, qty: 3 },
23 ],
24 served: 'On The Rocks',
25 }
26 for sd in [
27 { name: 'Yellow ', fruit: 'Lemonade' },
28 { name: '', fruit: 'Orange Juice' },
29 ]
30 },
31 }