Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

licensee

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

licensee - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

66

index.js

@@ -47,36 +47,39 @@ module.exports = licensee

function findIssues (configuration, tree, issues) {
function findIssues (configuration, tree, results) {
var dependencies = tree.children
// If there are dependencies, check license metadata.
if (typeof dependencies === 'object') {
return dependencies
.reduce(function (issues, tree) {
if (!acceptablePackage(configuration, tree)) {
issues.push({
name: tree.package.name,
license: tree.package.license,
version: tree.package.version,
parent: tree.parent,
path: tree.path
})
}
// Recurse dependencies.
return findIssues(configuration, tree, issues)
}, issues)
} else return issues
dependencies.forEach(function (tree) {
results.push(resultForPackage(configuration, tree))
findIssues(configuration, tree, results)
})
return results
} else return results
}
function acceptablePackage (configuration, tree) {
function resultForPackage (configuration, tree) {
var licenseExpression = configuration.license
var whitelist = configuration.whitelist
return (
// Is the package on the whitelist?
Object.keys(whitelist).some(function (name) {
return (
tree.package.name === name &&
satisfies(tree.package.version, whitelist[name]) === true
)
}) ||
// Does the package's license metadata match configuration?
(
var result = {
name: tree.package.name,
license: tree.package.license,
author: tree.package.author,
contributors: tree.package.contributors,
repository: tree.package.repository,
homepage: tree.package.homepage,
version: tree.package.version,
parent: tree.parent,
path: tree.path
}
var whitelisted = Object.keys(whitelist).some(function (name) {
return (
tree.package.name === name &&
satisfies(tree.package.version, whitelist[name]) === true
)
})
if (whitelisted) {
result.approved = true
result.whitelisted = true
} else {
var matchesRule = (
licenseExpression &&

@@ -89,3 +92,10 @@ validSPDX(licenseExpression) &&

)
)
if (matchesRule) {
result.approved = true
result.rule = true
} else {
result.approved = false
}
}
return result
}
{
"name": "licensee",
"description": "check dependency licenses against rules",
"version": "3.0.0",
"version": "4.0.0",
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com/)",

@@ -6,0 +6,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc