Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

501 B
Raw Blame
import type { TaskToImport } from "@/fetchers/task/import-tasks";

export function parseTasksImport(content: string): TaskToImport[] | null {
  const data: unknown = JSON.parse(content);
  if (typeof data !== "object" || data === null || !("tasks" in data)) {
    return null;
  }

  return Array.isArray(data.tasks) ? (data.tasks as TaskToImport[]) : null;
}

export function isJsonFile(file: Pick<File, "name" | "type">) {
  return file.type === "application/json" || file.name.endsWith(".json");
}