Skip to main content

getSanitizedTasks()

function getSanitizedTasks(tasks: {
addedAt: string | null;
addedByUid: string | null;
assignedByUid: string | null;
checked: boolean;
childOrder: number;
completedAt: string | null;
content: string;
dayOrder: number;
deadline: | {
date: string;
lang: string;
}
| null;
description: string;
due: | {
date: string;
datetime?: string | null;
isRecurring: boolean;
lang?: string | null;
string: string;
timezone?: string | null;
}
| null;
duration: | {
amount: number;
unit: "minute" | "day";
}
| null;
id: string;
isCollapsed: boolean;
isDeleted: boolean;
labels: string[];
noteCount: number;
parentId: string | null;
priority: number;
projectId: string;
responsibleUid: string | null;
sectionId: string | null;
updatedAt: string | null;
url: string;
userId: string;
}[]): TaskWithSanitizedContent[];

Takes an array of tasks and returns a new array with sanitized content added as 'sanitizedContent' property to each task.

Parameters

ParameterTypeDescription
tasks{ addedAt: string | null; addedByUid: string | null; assignedByUid: string | null; checked: boolean; childOrder: number; completedAt: string | null; content: string; dayOrder: number; deadline: | { date: string; lang: string; } | null; description: string; due: | { date: string; datetime?: string | null; isRecurring: boolean; lang?: string | null; string: string; timezone?: string | null; } | null; duration: | { amount: number; unit: "minute" | "day"; } | null; id: string; isCollapsed: boolean; isDeleted: boolean; labels: string[]; noteCount: number; parentId: string | null; priority: number; projectId: string; responsibleUid: string | null; sectionId: string | null; updatedAt: string | null; url: string; userId: string; }[]Array of Task objects to sanitize

Returns

TaskWithSanitizedContent[]

Array of tasks with added sanitizedContent property

See

getSanitizedContent

Example

const tasks = [{ content: '**Bold** task', ... }]
getSanitizedTasks(tasks) // [{ content: '**Bold** task', sanitizedContent: 'Bold task', ... }]