Notes/src/services/search/note_set.js

27 lines
460 B
JavaScript
Raw Normal View History

2020-05-17 09:48:24 +02:00
"use strict";
class NoteSet {
2020-05-16 23:12:29 +02:00
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);
}
}
2020-05-17 09:48:24 +02:00
module.exports = NoteSet;