質問編集履歴
3
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,13 +36,9 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
if (duplicatedNotes.length > 0) {
|
39
|
+
if (duplicatedNotes.length > 0) { return null; }
|
40
40
|
|
41
|
-
|
41
|
+
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
42
|
|
47
43
|
notes.push(note);
|
48
44
|
|
2
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,19 +36,19 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
if (duplicatedNotes.length
|
39
|
+
if (duplicatedNotes.length > 0) {
|
40
|
-
|
41
|
-
notes.push(note);
|
42
|
-
|
43
|
-
this.saveNotes(notes);
|
44
|
-
|
45
|
-
return note;
|
46
|
-
|
47
|
-
} else {
|
48
40
|
|
49
41
|
return null;
|
50
42
|
|
51
43
|
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
notes.push(note);
|
48
|
+
|
49
|
+
this.saveNotes(notes);
|
50
|
+
|
51
|
+
return note;
|
52
52
|
|
53
53
|
}
|
54
54
|
|
1
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,17 +6,9 @@
|
|
6
6
|
|
7
7
|
getNote(title) {
|
8
8
|
|
9
|
-
|
10
|
-
|
11
9
|
const notes = this._fetchNotes();
|
12
10
|
|
13
|
-
const filteredNotes = notes.filter(
|
11
|
+
const filteredNotes = notes.filter(note => note.title === title);
|
14
|
-
|
15
|
-
return note.title === title;
|
16
|
-
|
17
|
-
});
|
18
|
-
|
19
|
-
|
20
12
|
|
21
13
|
return filteredNotes.length > 0 ? filteredNotes[0] : null;
|
22
14
|
|
@@ -34,21 +26,15 @@
|
|
34
26
|
|
35
27
|
addNote(title, body) {
|
36
28
|
|
37
|
-
|
38
|
-
|
39
29
|
let notes = this._fetchNotes();
|
40
30
|
|
41
31
|
const note = {title, body};
|
42
32
|
|
43
33
|
|
44
34
|
|
45
|
-
const duplicatedNotes = notes.filter(
|
35
|
+
const duplicatedNotes = notes.filter(note => note.title === title);
|
46
36
|
|
47
|
-
|
37
|
+
|
48
|
-
|
49
|
-
});
|
50
|
-
|
51
|
-
|
52
38
|
|
53
39
|
if (duplicatedNotes.length === 0) {
|
54
40
|
|