Skip to content

Commit 5ec7eb0

Browse files
committed
refactor: improve code/comments readability
1 parent 3fecb89 commit 5ec7eb0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,23 @@ function urlBuilderAuthorize(
5454
let url = base;
5555

5656
Object.keys(map)
57-
.filter((k) => options[k] !== null) // Filter out keys that are null and remove the url key
57+
// Filter out keys that are null and remove the url key
58+
.filter((k) => options[k] !== null)
59+
60+
// Filter out empty scopes array
5861
.filter((k) => {
5962
if (k !== "scopes") return true;
6063
if (options.clientType === "github-app") return false;
6164

6265
return !Array.isArray(options[k]) || (options[k] as string[]).length > 1;
63-
}) // Filter out empty scopes array
66+
})
67+
68+
// Map Array with the proper URL parameter names and change the value to a string using template strings
6469
// @ts-ignore
65-
.map((key) => [map[key], `${options[key]}`]) // Map Array with the proper URL parameter names and change the value to a string using template strings
70+
.map((key) => [map[key], `${options[key]}`])
71+
72+
// Finally, build the URL
6673
.forEach(([key, value], index) => {
67-
// Finally, build the URL
6874
url += index === 0 ? `?` : "&";
6975
url += `${key}=${value}`;
7076
});

0 commit comments

Comments
 (0)