23 lines
433 B
JavaScript
Raw Normal View History

2020-05-16 23:12:29 +02:00
export default class NoteSet {
constructor(notes = []) {
this.notes = notes;
}
add(note) {
this.notes.push(note);
}
addAll(notes) {
this.notes.push(...notes);
}
hasNoteId(noteId) {
// TODO: optimize
return !!this.notes.find(note => note.noteId === noteId);
}
mergeIn(anotherNoteSet) {
this.notes = this.notes.concat(anotherNoteSet.arr);
}
}