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

Function normalizeFolderList

src/api/TaskNotesAPI.ts:3139–3168  ·  view source on GitHub ↗
(
	value: unknown,
	path: string,
	issues: TaskNotesRuntimeQueryIssue[]
)

Source from the content-addressed store, hash-verified

3137}
3138
3139function normalizeFolderList(
3140 value: unknown,
3141 path: string,
3142 issues: TaskNotesRuntimeQueryIssue[]
3143): string[] | undefined {
3144 if (typeof value === "undefined") return undefined;
3145 if (!Array.isArray(value)) {
3146 issues.push({
3147 path,
3148 code: "folder_list_invalid",
3149 message: "Runtime query folder scope must be an array of folder paths.",
3150 });
3151 return undefined;
3152 }
3153
3154 const folders = value
3155 .map((folder, index) => {
3156 if (typeof folder !== "string" || folder.trim().length === 0) {
3157 issues.push({
3158 path: `${path}.${index}`,
3159 code: "folder_invalid",
3160 message: "Runtime query folder path must be a non-empty string.",
3161 });
3162 return null;
3163 }
3164 return normalizePath(folder);
3165 })
3166 .filter(isDefined);
3167 return folders.length > 0 ? folders : undefined;
3168}
3169
3170function normalizeRuntimeValue(value: unknown): TaskNotesRuntimeValue {
3171 if (Array.isArray(value)) return value.map(normalizeRuntimeValue);

Callers 1

normalizeRuntimeScopeFunction · 0.85

Calls 1

normalizePathFunction · 0.90

Tested by

no test coverage detected