Use null for unspecified values when filtering licenses.
This commit is contained in:
+3
-3
@@ -76,7 +76,7 @@ exports.getDeniedLicenseChanges = void 0;
|
|||||||
* @returns {Array<Change} The list of denied changes.
|
* @returns {Array<Change} The list of denied changes.
|
||||||
*/
|
*/
|
||||||
function getDeniedLicenseChanges(changes, licenses) {
|
function getDeniedLicenseChanges(changes, licenses) {
|
||||||
let { allow = [], deny = [] } = licenses;
|
let { allow = null, deny = null } = licenses;
|
||||||
let disallowed = [];
|
let disallowed = [];
|
||||||
for (const change of changes) {
|
for (const change of changes) {
|
||||||
let license = change.license;
|
let license = change.license;
|
||||||
@@ -84,12 +84,12 @@ function getDeniedLicenseChanges(changes, licenses) {
|
|||||||
if (license === null) {
|
if (license === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (allow.length > 0) {
|
if (allow !== null) {
|
||||||
if (!allow.includes(license)) {
|
if (!allow.includes(license)) {
|
||||||
disallowed.push(change);
|
disallowed.push(change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (deny.length > 0) {
|
else if (deny !== null) {
|
||||||
if (deny.includes(license)) {
|
if (deny.includes(license)) {
|
||||||
disallowed.push(change);
|
disallowed.push(change);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+3
-3
@@ -14,7 +14,7 @@ export function getDeniedLicenseChanges(
|
|||||||
deny?: Array<string>
|
deny?: Array<string>
|
||||||
}
|
}
|
||||||
): Array<Change> {
|
): Array<Change> {
|
||||||
let {allow = [], deny = []} = licenses
|
let {allow = null, deny = null} = licenses
|
||||||
|
|
||||||
let disallowed: Change[] = []
|
let disallowed: Change[] = []
|
||||||
|
|
||||||
@@ -24,11 +24,11 @@ export function getDeniedLicenseChanges(
|
|||||||
if (license === null) {
|
if (license === null) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (allow.length > 0) {
|
if (allow !== null) {
|
||||||
if (!allow.includes(license)) {
|
if (!allow.includes(license)) {
|
||||||
disallowed.push(change)
|
disallowed.push(change)
|
||||||
}
|
}
|
||||||
} else if (deny.length > 0) {
|
} else if (deny !== null) {
|
||||||
if (deny.includes(license)) {
|
if (deny.includes(license)) {
|
||||||
disallowed.push(change)
|
disallowed.push(change)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user