@octokit/oauth-authorization-url
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -86,12 +86,12 @@ 'use strict'; | ||
let url = base; | ||
Object.keys(map).filter(k => options[k] !== null) // Filter out keys that are null and remove the url key | ||
Object.keys(map) // Filter out keys that are null and remove the url key | ||
.filter(k => options[k] !== null) // Filter out empty scopes array | ||
.filter(k => { | ||
if (k !== "scopes") return true; | ||
if (options.clientType === "github-app") return false; | ||
return !Array.isArray(options[k]) || options[k].length > 1; | ||
}) // Filter out empty scopes array | ||
return !Array.isArray(options[k]) || options[k].length > 0; | ||
}) // Map Array with the proper URL parameter names and change the value to a string using template strings | ||
// @ts-ignore | ||
.map(key => [map[key], `${options[key]}`]) // Map Array with the proper URL parameter names and change the value to a string using template strings | ||
.map(key => [map[key], `${options[key]}`]) // Finally, build the URL | ||
.forEach(([key, value], index) => { | ||
// Finally, build the URL | ||
url += index === 0 ? `?` : "&"; | ||
@@ -98,0 +98,0 @@ url += `${key}=${value}`; |
@@ -41,3 +41,5 @@ export function oauthAuthorizationUrl(options) { | ||
Object.keys(map) | ||
.filter((k) => options[k] !== null) // Filter out keys that are null and remove the url key | ||
// Filter out keys that are null and remove the url key | ||
.filter((k) => options[k] !== null) | ||
// Filter out empty scopes array | ||
.filter((k) => { | ||
@@ -48,8 +50,9 @@ if (k !== "scopes") | ||
return false; | ||
return !Array.isArray(options[k]) || options[k].length > 1; | ||
}) // Filter out empty scopes array | ||
return !Array.isArray(options[k]) || options[k].length > 0; | ||
}) | ||
// Map Array with the proper URL parameter names and change the value to a string using template strings | ||
// @ts-ignore | ||
.map((key) => [map[key], `${options[key]}`]) // Map Array with the proper URL parameter names and change the value to a string using template strings | ||
.map((key) => [map[key], `${options[key]}`]) | ||
// Finally, build the URL | ||
.forEach(([key, value], index) => { | ||
// Finally, build the URL | ||
url += index === 0 ? `?` : "&"; | ||
@@ -56,0 +59,0 @@ url += `${key}=${value}`; |
@@ -41,3 +41,5 @@ function oauthAuthorizationUrl(options) { | ||
Object.keys(map) | ||
.filter((k) => options[k] !== null) // Filter out keys that are null and remove the url key | ||
// Filter out keys that are null and remove the url key | ||
.filter((k) => options[k] !== null) | ||
// Filter out empty scopes array | ||
.filter((k) => { | ||
@@ -48,8 +50,9 @@ if (k !== "scopes") | ||
return false; | ||
return !Array.isArray(options[k]) || options[k].length > 1; | ||
}) // Filter out empty scopes array | ||
return !Array.isArray(options[k]) || options[k].length > 0; | ||
}) | ||
// Map Array with the proper URL parameter names and change the value to a string using template strings | ||
// @ts-ignore | ||
.map((key) => [map[key], `${options[key]}`]) // Map Array with the proper URL parameter names and change the value to a string using template strings | ||
.map((key) => [map[key], `${options[key]}`]) | ||
// Finally, build the URL | ||
.forEach(([key, value], index) => { | ||
// Finally, build the URL | ||
url += index === 0 ? `?` : "&"; | ||
@@ -56,0 +59,0 @@ url += `${key}=${value}`; |
{ | ||
"name": "@octokit/oauth-authorization-url", | ||
"description": "Universal library to retrieve GitHubâs identity URL for the OAuth web flow", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27591
260