From fa44d81b658024685e0496150d66a51f2f5fda8c Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 27 Jul 2021 16:49:53 +0200 Subject: Improved a bunch of small things in the backend --- packages/server/src/git/patch.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'packages/server/src/git/patch.ts') diff --git a/packages/server/src/git/patch.ts b/packages/server/src/git/patch.ts index 8eaaaf1..45ffe23 100644 --- a/packages/server/src/git/patch.ts +++ b/packages/server/src/git/patch.ts @@ -168,4 +168,25 @@ export class Patch { return hunks_data.hunks; } + + /** + * Returns a patch from a diff + * + * @param diff - The diff which the patch is in + * @param index - The index of a patch + * @returns An instance of a patch + */ + public static async fromDiff(diff: Diff, index: number): Promise { + return diff.patch(index); + } + + /** + * Returns all of the patches from a diff + * + * @param diff - A diff + * @returns An array of patch instances + */ + public static async allFromDiff(diff: Diff): Promise { + return diff.patches(); + } } \ No newline at end of file -- cgit v1.2.3-18-g5258