MCPcopy
hub / github.com/callumalpass/tasknotes / isTaskFrontmatter

Function isTaskFrontmatter

src/utils/taskIdentification.ts:29–58  ·  view source on GitHub ↗
(
	frontmatter: unknown,
	settings: TaskIdentificationSettings
)

Source from the content-addressed store, hash-verified

27}
28
29export function isTaskFrontmatter(
30 frontmatter: unknown,
31 settings: TaskIdentificationSettings
32): boolean {
33 if (!isFrontmatterRecord(frontmatter)) {
34 return false;
35 }
36
37 if (settings.taskIdentificationMethod === "property") {
38 const propName = settings.taskPropertyName;
39 const propValue = settings.taskPropertyValue;
40 if (!propName || !propValue) return false;
41
42 const frontmatterValue = frontmatter[propName];
43 if (frontmatterValue === undefined) return false;
44
45 if (Array.isArray(frontmatterValue)) {
46 return frontmatterValue.some((val: unknown) =>
47 compareTaskPropertyIdentifierValue(val, propValue)
48 );
49 }
50
51 return compareTaskPropertyIdentifierValue(frontmatterValue, propValue);
52 }
53
54 const tags = getFrontmatterTags(frontmatter.tags);
55 return tags.some((tag) => {
56 return FilterUtils.matchesHierarchicalTagExact(tag, settings.taskTag);
57 });
58}

Callers 2

isTaskFileMethod · 0.90
isTaskFileFunction · 0.90

Calls 4

getFrontmatterTagsFunction · 0.90
isFrontmatterRecordFunction · 0.85

Tested by 1

isTaskFileFunction · 0.72