From 5b7bb5d878920f121da465b10ffcc412d83cbe53 Mon Sep 17 00:00:00 2001 From: Krzysztof Wolski Date: Thu, 1 Sep 2022 17:18:32 +0200 Subject: [PATCH] Add util function docstring --- src/APL/fileAPL.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/APL/fileAPL.ts b/src/APL/fileAPL.ts index d9d162f..b850606 100644 --- a/src/APL/fileAPL.ts +++ b/src/APL/fileAPL.ts @@ -5,6 +5,12 @@ import { APL, AuthData } from "./apl"; const debug = debugPkg.debug("FileAPL"); +/** + * Load auth data from a file and return it as AuthData format. + * In case of incomplete or invalid data, return `undefined`. + * + * @param {string} fileName + */ export const loadDataFromFile = async (fileName: string): Promise => { debug(`Load auth data from the ${fileName} file`); let parsedData: Record = {}; @@ -22,6 +28,13 @@ export const loadDataFromFile = async (fileName: string): Promise { debug(`Save auth data to the ${fileName} file`); const newData = authData ? JSON.stringify(authData) : "{}";