From 09ff261f156a8599d45c1496fe246ded6e035191 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 26 Jul 2021 23:56:53 +0200 Subject: Added backend TSDoc/JSDoc comments & refactored a tiny bit --- packages/server/src/git/blob.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'packages/server/src/git/blob.ts') diff --git a/packages/server/src/git/blob.ts b/packages/server/src/git/blob.ts index ef9f9ab..eebd2d4 100644 --- a/packages/server/src/git/blob.ts +++ b/packages/server/src/git/blob.ts @@ -2,21 +2,38 @@ import { BlobError, createError } from "./error"; import { Tree } from "./tree"; import { BlobTreeEntry } from "./tree_entry"; +/** + * A representation of a blob + */ export class Blob { private _tree_entry: BlobTreeEntry; public path; + /** + * @param entry - A tree entry that's a blob + * @param path - A path + */ constructor(entry: BlobTreeEntry, path: string) { this._tree_entry = entry; this.path = path; } + /** + * Returns the blob's content + */ public async content(): Promise { return this._tree_entry.content(); } + /** + * Returns a blob from a path in a tree + * + * @param tree - The tree to look in + * @param path - A path to a blob + * @returns An instance of a blob + */ public static async fromPath(tree: Tree, path: string): Promise { const entry = await tree.find(path); -- cgit v1.2.3-18-g5258