Skip to main content

getSanitizedTasks()

function getSanitizedTasks(tasks: {
addedAt: null | string;
addedByUid: null | string;
assignedByUid: null | string;
checked: boolean;
childOrder: number;
completedAt: null | string;
content: string;
dayOrder: number;
deadline: | null
| {
date: string;
lang: string;
};
description: string;
due: | null
| {
date: string;
datetime?: null | string;
isRecurring: boolean;
lang?: null | string;
string: string;
timezone?: null | string;
};
duration: | null
| {
amount: number;
unit: "minute" | "day";
};
id: string;
isCollapsed: boolean;
isDeleted: boolean;
labels: string[];
noteCount: number;
parentId: null | string;
priority: number;
projectId: string;
responsibleUid: null | string;
sectionId: null | string;
updatedAt: null | string;
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: null | string; addedByUid: null | string; assignedByUid: null | string; checked: boolean; childOrder: number; completedAt: null | string; content: string; dayOrder: number; deadline: | null | { date: string; lang: string; }; description: string; due: | null | { date: string; datetime?: null | string; isRecurring: boolean; lang?: null | string; string: string; timezone?: null | string; }; duration: | null | { amount: number; unit: "minute" | "day"; }; id: string; isCollapsed: boolean; isDeleted: boolean; labels: string[]; noteCount: number; parentId: null | string; priority: number; projectId: string; responsibleUid: null | string; sectionId: null | string; updatedAt: null | string; 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', ... }]