console.log('Starting notes.js');

const fs = require('fs');

var addNote = (title, body) => {
  var notes = [];

  var note = {
    title,
    body
  };

  try {
    var notesString = fs.readFileSync('notes-data.json');
    notes = JSON.parse(notesString);
  } catch (e) {

  }

  var duplicateNotes = notes.filter((note) => note.title === title);

  if (duplicateNotes.length == 0) {
    notes.push(note);
    fs.writeFileSync('notes-data.json', JSON.stringify(notes));
  }
};

var getAll = () => {
  console.log('Listing all notes');
};

var getNote = (title) => {
  console.log('Reading note', title);
};

var removeNote = (title) => {
  console.log('Removing note', title); 
};

module.exports = {
  addNote,
  getAll,
  getNote,
  removeNote
};

@@ -59,34 +59,31 @@
 );%0A%0A
-var add
+const get
 Note
+s
  = (
-title, body
+fname
 ) =%3E
@@ -107,173 +107,489 @@
 %5B%5D;%0A
+  
 %0A  
-var note = %7B%0A    title,%0A    body
+try %7B%0A    var notesString = fs.readFileSync(fname);%0A    notes = JSON.parse(notesString);%0A  %7D catch (e) %7B%0A
 %0A  %7D
-;%0A
 %0A  
-try %7B%0A    var notesString = fs.readFileSync('notes-data.json
+return notes;%0A%7D;%0A%0Aconst saveNotes = (fname, notes) =%3E %7B%0A    fs.writeFileSync(fname, JSON.stringify(notes));%0A%7D;%0A%0Aconst showNote = (note) =%3E %7B%0A  console.log('------------
 ');%0A  
- 
- notes = JSON.parse(notesString
+console.log('Title:', note.title);%0A  console.log('Body:', note.body);%0A%7D;%0A%0Avar addNote = (title, body) =%3E %7B%0A  var notes = getNotes('notes-data.json'
 );%0A
+%0A
   
-%7D catch (e) %7B%0A
+var note = %7B%0A    title,%0A    body
 %0A  %7D
+;
 %0A%0A  
@@ -718,32 +718,25 @@
 e);%0A    
-fs.writeFileSync
+saveNotes
 ('notes-
@@ -747,39 +747,22 @@
 .json', 
-JSON.stringify(
 notes)
-);
 %0A  %7D%0A%7D;%0A
@@ -789,32 +789,193 @@
 %7B%0A  
-console.log('Listing all
+var notes = getNotes('notes-data.json');%0A  if (notes.length %3E 0) %7B%0A    notes.forEach((note) =%3E showNote(note));%0A    console.log('------------');%0A  %7D else %7B%0A    console.log('There are no
  not
@@ -980,16 +980,20 @@
 otes');%0A
+  %7D%0A
 %7D;%0A%0Avar 
@@ -1021,117 +1021,442 @@
 %7B%0A  
-console.log('Reading note', title);%0A%7D;%0A%0Avar removeNote = (title) =%3E %7B%0A  console.log('Removing note', title); 
+var notes = getNotes('notes-data.json'); %0A  var filtered = notes.filter((note) =%3E note.title === title);%0A  if (filtered.length %3E 0) %7B%0A    showNote(filtered%5B0%5D);%0A  %7D else %7B%0A    console.log('There is no such note');%0A  %7D%0A%7D;%0A%0Avar removeNote = (title) =%3E %7B%0A  var notes = getNotes('notes-data.json');%0A  var filtered = notes.filter((note) =%3E note.title !== title);%0A  if (filtered.length %3E 0) %7B%0A    saveNotes('notes-data.json', filtered);%0A  %7D
 %0A%7D;%0A

Realize all the functions