From fa56d7ceccc28fe7558afc940c21a88c4d25b4f1 Mon Sep 17 00:00:00 2001 From: Abkarino <9306140+abkarino@users.noreply.github.com> Date: Fri, 14 Oct 2022 02:59:15 +0200 Subject: [PATCH] allow passing an array in getbatch.add --- GetBatch.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GetBatch.ts b/GetBatch.ts index f4dfea6..c12e5e1 100644 --- a/GetBatch.ts +++ b/GetBatch.ts @@ -12,11 +12,12 @@ class GetBatch { /** * Add a document to the retrive list - * @param {string} docPath The document to fetch + * @param {string|string[]} docPath One or multiple documents to fetch * @returns This `WriteBatch` instance. Used for chaining method calls. */ - add(docPath: string): GetBatch { - this.#documents.push(docPath); + add(docPath: string | string[]): GetBatch { + if (typeof docPath === 'string') this.#documents.push(docPath); + else docPath.forEach((docPath) => this.#documents.push(docPath)); return this; }