MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / writeSortOrder

Function writeSortOrder

src/bases/sortOrderUtils.ts:545–557  ·  view source on GitHub ↗
(
	path: string,
	sortOrder: string,
	plugin: TaskNotesPlugin
)

Source from the content-addressed store, hash-verified

543}
544
545async function writeSortOrder(
546 path: string,
547 sortOrder: string,
548 plugin: TaskNotesPlugin
549): Promise<void> {
550 const file = plugin.app.vault.getAbstractFileByPath(path);
551 if (!(file instanceof TFile)) return;
552
553 const sortOrderField = plugin.settings.fieldMapping.sortOrder;
554 await plugin.app.fileManager.processFrontMatter(file, (frontmatter) => {
555 frontmatter[sortOrderField] = sortOrder;
556 });
557}
558
559/**
560 * Prepare a sort-order update plan without writing any files yet.

Callers 1

applySortOrderPlanFunction · 0.85

Calls 2

getAbstractFileByPathMethod · 0.80
processFrontMatterMethod · 0.65

Tested by

no test coverage detected