Socket
Socket
Sign inDemoInstall

spdx-correct

Package Overview
Dependencies
3
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.1.0

21

index.js
/*
Copyright 2015 Kyle E. Mitchell
Copyright spdx-correct.js contributors

@@ -280,3 +280,8 @@ Licensed under the Apache License, Version 2.0 (the "License");

module.exports = function (identifier) {
module.exports = function (identifier, options) {
options = options || {}
var upgrade = options.upgrade === undefined ? true : !!options.upgrade
function postprocess (value) {
return upgrade ? upgradeGPLs(value) : value
}
var validArugment = (

@@ -291,11 +296,11 @@ typeof identifier === 'string' &&

if (valid(identifier)) {
return upgradeGPLs(identifier)
return postprocess(identifier)
}
var noPlus = identifier.replace(/\+$/, '').trim()
if (valid(noPlus)) {
return upgradeGPLs(noPlus)
return postprocess(noPlus)
}
var transformed = validTransformation(identifier)
if (transformed !== null) {
return upgradeGPLs(transformed)
return postprocess(transformed)
}

@@ -309,11 +314,11 @@ transformed = anyCorrection(identifier, function (argument) {

if (transformed !== null) {
return upgradeGPLs(transformed)
return postprocess(transformed)
}
transformed = validLastResort(identifier)
if (transformed !== null) {
return upgradeGPLs(transformed)
return postprocess(transformed)
}
transformed = anyCorrection(identifier, validLastResort)
if (transformed !== null) {
return upgradeGPLs(transformed)
return postprocess(transformed)
}

@@ -320,0 +325,0 @@ return null

{
"name": "spdx-correct",
"description": "correct invalid SPDX expressions",
"version": "3.0.2",
"version": "3.1.0",
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)",

@@ -9,3 +9,4 @@ "contributors": [

"Christian Zommerfelds <aero_super@yahoo.com>",
"Tal Einat <taleinat@gmail.com>"
"Tal Einat <taleinat@gmail.com>",
"Dan Butvinik <butvinik@outlook.com>"
],

@@ -12,0 +13,0 @@ "dependencies": {

@@ -10,2 +10,6 @@ ```javascript

assert(correct('No idea what license') === null)
// disable upgrade option
assert(correct('GPL-3.0'), 'GPL-3.0-or-later')
assert(correct('GPL-3.0', { upgrade: false }), 'GPL-3.0')
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc