Use null for unspecified values when filtering licenses.

This commit is contained in:
Federico Builes
2022-06-08 18:21:28 +02:00
parent a7d02aef82
commit a51db20961
3 changed files with 7 additions and 7 deletions

6
dist/index.js generated vendored
View File

@@ -76,7 +76,7 @@ exports.getDeniedLicenseChanges = void 0;
* @returns {Array<Change} The list of denied changes.
*/
function getDeniedLicenseChanges(changes, licenses) {
let { allow = [], deny = [] } = licenses;
let { allow = null, deny = null } = licenses;
let disallowed = [];
for (const change of changes) {
let license = change.license;
@@ -84,12 +84,12 @@ function getDeniedLicenseChanges(changes, licenses) {
if (license === null) {
continue;
}
if (allow.length > 0) {
if (allow !== null) {
if (!allow.includes(license)) {
disallowed.push(change);
}
}
else if (deny.length > 0) {
else if (deny !== null) {
if (deny.includes(license)) {
disallowed.push(change);
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -14,7 +14,7 @@ export function getDeniedLicenseChanges(
deny?: Array<string>
}
): Array<Change> {
let {allow = [], deny = []} = licenses
let {allow = null, deny = null} = licenses
let disallowed: Change[] = []
@@ -24,11 +24,11 @@ export function getDeniedLicenseChanges(
if (license === null) {
continue
}
if (allow.length > 0) {
if (allow !== null) {
if (!allow.includes(license)) {
disallowed.push(change)
}
} else if (deny.length > 0) {
} else if (deny !== null) {
if (deny.includes(license)) {
disallowed.push(change)
}