chore(prettier): fix all files

This commit is contained in:
Elian Doran
2025-01-09 18:07:02 +02:00
parent 19ee861699
commit 4cbb529fd4
571 changed files with 23226 additions and 23940 deletions

View File

@@ -1,7 +1,7 @@
import { toObject } from "./utils.js";
import BackendScriptApi from "./backend_script_api.js";
import BNote from "../becca/entities/bnote.js";
import { ApiParams } from './backend_script_api_interface.js';
import { ApiParams } from "./backend_script_api_interface.js";
type Module = {
exports: any[];
@@ -16,22 +16,22 @@ class ScriptContext {
constructor(allNotes: BNote[], apiParams: ApiParams) {
this.allNotes = allNotes;
this.modules = {};
this.notes = toObject(allNotes, note => [note.noteId, note]);
this.apis = toObject(allNotes, note => [note.noteId, new BackendScriptApi(note, apiParams)]);
this.notes = toObject(allNotes, (note) => [note.noteId, note]);
this.apis = toObject(allNotes, (note) => [note.noteId, new BackendScriptApi(note, apiParams)]);
}
require(moduleNoteIds: string[]) {
return (moduleName: string) => {
const candidates = this.allNotes.filter(note => moduleNoteIds.includes(note.noteId));
const note = candidates.find(c => c.title === moduleName);
const candidates = this.allNotes.filter((note) => moduleNoteIds.includes(note.noteId));
const note = candidates.find((c) => c.title === moduleName);
if (!note) {
return require(moduleName);
}
return this.modules[note.noteId].exports;
}
};
};
}
}
export default ScriptContext;