Skip to content

Commit

Permalink
Remove unused canAdd (yomidevs#824)
Browse files Browse the repository at this point in the history
Co-authored-by: James Maa <[email protected]>
  • Loading branch information
jamesmaa and James Maa authored Apr 16, 2024
1 parent 643caf0 commit 6e1cb32
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions ext/js/background/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,10 @@ export class Backend {
async _onApiGetAnkiNoteInfo({notes, fetchAdditionalInfo}) {
const {canAddArray, cannotAddArray} = await this.partitionAddibleNotes(notes);

/** @type {{note: import('anki').Note, info: import('anki').NoteInfoWrapper}[]} */
const cannotAdd = cannotAddArray.filter((note) => isNoteDataValid(note)).map((note) => ({note, info: {canAdd: false, valid: false, noteIds: null}}));

/** @type {import('anki').NoteInfoWrapper[]} */
const results = cannotAdd.map(({info}) => info);
const results = cannotAddArray
.filter((note) => isNoteDataValid(note))
.map(() => ({canAdd: false, valid: false, noteIds: null}));

/** @type {import('anki').Note[]} */
const duplicateNotes = [];
Expand Down Expand Up @@ -607,10 +606,6 @@ export class Backend {
};

results.push(info);

if (!valid) {
cannotAdd.push({note, info});
}
}

return results;
Expand Down

0 comments on commit 6e1cb32

Please sign in to comment.