MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / applyFieldDefaults

Function applyFieldDefaults

src/core/createCompat.ts:114–123  ·  view source on GitHub ↗
(frontmatter: UnknownRecord, taskType: TaskTypeDefLike | undefined)

Source from the content-addressed store, hash-verified

112}
113
114function applyFieldDefaults(frontmatter: UnknownRecord, taskType: TaskTypeDefLike | undefined): void {
115 const fields = taskType?.fields;
116 if (!fields) return;
117
118 for (const [fieldName, fieldDef] of Object.entries(fields)) {
119 if (fieldDef.default !== undefined && !hasValue(frontmatter[fieldName])) {
120 frontmatter[fieldName] = fieldDef.default;
121 }
122 }
123}
124
125function applyMatchDefaults(frontmatter: UnknownRecord, taskType: TaskTypeDefLike | undefined): void {
126 const where = taskType?.match?.where;

Callers 1

createTaskWithCompatFunction · 0.85

Calls 1

hasValueFunction · 0.85

Tested by

no test coverage detected