Checkpoint: brackets, blocks and lines
The technique
f{ lands on the outer bracket and ; on the inner one. From there di{ empties the inner pair. Inside the outer pair, it would empty that one instead.
Keys in this lesson
- ci(
- Change the text inside round brackets.
- ci{
- Change inside curly brackets.
- %
- The matching bracket.
- d%
- Delete to the matching bracket, brackets included.
- dap
- Delete the paragraph and a blank line.
- J
- Join the next line to this one.
- >>
- Indent the line.
Before this lesson: Text objects for brackets, %, deleting to a search, registers, paragraphs and the jump list.
More about this lesson
Make three changes in each of three real files: an API module, a config and a test.
You choose the commands here. Look at the shape of the code first: a change inside brackets is ci( or di{, a call with nested brackets goes with d%, a block between blank lines is a paragraph, and J joins a line that was split. Help is still there if you need it, and your result notes whether you used it.
Example
Before you start, read the task and find every line that changes. Check the whole result when you're done.
Try without hints first. Open help if you need it.
Guides on this topic
Exercise 1 of 3
0keys
par 36The API knows the customer from the session and pages by itself now: make the query just { limit: 50 }. It drops drafts too, so remove the .filter(…) call. And cancelling is a PATCH now, not a POST. You can use any commands.
Make it look like this
import { request } from "./http"; // Orders for the account page, newest first. export function listOrders(customerId) { return request("GET", "/orders", { limit: 50 }) .then((response) => response.json()) .then((body) => body.orders); } export function cancelOrder(orderId) { return request("PATCH", `/orders/${orderId}/cancel`); }