microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
iadavis/pipeline-issue-debugging

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

source/npm/qsharp/src/katas-md.ts

28lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4// IMPORTANT: This file is kept stand-alone from the general katas.ts so
5// that the Markdown version of the bundle is not pulled into any packages
6// when not needed, thus reducing bundle sizes for the production site.
7
8import { default as katasContent } from "./katas-content.generated.md.js";
9
10import type { Kata, Exercise } from "./katas.js";
11
12export async function getAllKatas(
13 options: { includeUnpublished?: boolean } = { includeUnpublished: false },
14): Promise<Kata[]> {
15 return katasContent.katas.filter(
16 (k) => options.includeUnpublished || k.published,
17 ) as Kata[];
18}
19
20export async function getExerciseSources(
21 exercise: Exercise,
22): Promise<string[]> {
23 return katasContent.globalCodeSources
24 .filter((source) => exercise.sourceIds.indexOf(source.id) > -1)
25 .map((source) => source.code);
26}
27
28export type { Exercise, Kata };
29