| 27 | } |
| 28 | |
| 29 | export 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 | } |