Skip to content

Commit

Permalink
feat: 유틸 함수 JSDoc 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seokzin committed Dec 11, 2022
1 parent b7e8e77 commit c4c3753
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/add.ts
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 6 additions & 0 deletions utils/bfs.ts
Original file line number Diff line number Diff line change
@@ -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 = [];
Expand Down
6 changes: 6 additions & 0 deletions utils/binarySearch.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit c4c3753

Please sign in to comment.