1+++
2repository_url = "https://github.com/octocat/hello-world"
3revision = "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"
4+++
5
6## Edit History
7
8```diff
9--- a/README
10+++ b/README
11@@ -1,1 +1,6 @@
12-Hello World!
13+function filterByStatus(items, status) {
14+ return items.filter(item => item.status === status);
15+}
16+
17+function groupBy
18+
19```
20
21// User accepted prediction:
22```diff
23--- a/README
24+++ b/README
25@@ -4,3 +4,9 @@
26
27-function groupBy
28+function groupByStatus(items) {
29+ return items.reduce((groups, item) => {
30+ const key = item.status;
31+ (groups[key] = groups[key] || []).push(item);
32+ return groups;
33+ }, {});
34+}
35
36```
37
38```diff
39--- a/README
40+++ b/README
41@@ -4,4 +4,4 @@
42
43-function groupByStatus(items) {
44+function groupByCat(items) {
45 return items.reduce((groups, item) => {
46```
47
48## Cursor Position
49
50```README
51function filterByStatus(items, status) {
52 return items.filter(item => item.status === status);
53}
54
55function groupByCat(items) {
56# ^[CURSOR_POSITION]
57 return items.reduce((groups, item) => {
58 const key = item.status;
59 (groups[key] = groups[key] || []).push(item);
60 return groups;
61 }, {});
62}
63
64```
65
66## Expected Patch
67
68```diff
69--- a/README
70+++ b/README
71@@ -5,7 +5,7 @@
72-function groupByCat(items) {
73+function groupByCategory(items) {
74# ^[CURSOR_POSITION]
75 return items.reduce((groups, item) => {
76- const key = item.status;
77+ const key = item.category;
78 (groups[key] = groups[key] || []).push(item);
79 return groups;
80 }, {});
81```