From c4c375364d0a4bdce6097b4c9e000c27ca926926 Mon Sep 17 00:00:00 2001 From: seokzin Date: Sun, 11 Dec 2022 19:14:24 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9C=A0=ED=8B=B8=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20JSDoc=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/add.ts | 5 +++++ utils/bfs.ts | 6 ++++++ utils/binarySearch.ts | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/utils/add.ts b/utils/add.ts index a2606e3..9a94720 100644 --- a/utils/add.ts +++ b/utils/add.ts @@ -1,3 +1,8 @@ +/** + * Adds numbers together + * @param args Number list + * @returns The sum of number list + */ const add = (...args: number[]) => [...args].reduce((a, b) => a + b); export default add; diff --git a/utils/bfs.ts b/utils/bfs.ts index 1bc6535..9e62a0d 100644 --- a/utils/bfs.ts +++ b/utils/bfs.ts @@ -1,3 +1,9 @@ +/** + * Breadth-first search + * @param graph - Graph to search + * @param node - Node to start search from + * @returns Visited nodes + */ const bfs = (graph: { [key: string]: string[] }, node: string) => { const queue = [node]; const visited = []; diff --git a/utils/binarySearch.ts b/utils/binarySearch.ts index 950a1a0..7f4d95e 100644 --- a/utils/binarySearch.ts +++ b/utils/binarySearch.ts @@ -1,3 +1,9 @@ +/** + * Binary search + * @param list - Number list to search + * @param callback - Callback function to compare + * @returns Index of the number + */ const binarySearch = (list: number[], callback) => { let start = 0; let end = list.length - 1;