spdx-correct
Advanced tools
Comparing version 3.1.1 to 3.2.0
26
index.js
@@ -28,2 +28,14 @@ /* | ||
// Sorting function that orders the given array of transpositions such | ||
// that a transposition with the longer pattern comes before a transposition | ||
// with a shorter pattern. This is to prevent e.g. the transposition | ||
// ["General Public License", "GPL"] from matching to "Lesser General Public License" | ||
// before a longer and more accurate transposition ["Lesser General Public License", "LGPL"] | ||
// has a chance to be recognized. | ||
function sortTranspositions(a, b) { | ||
var length = b[0].length - a[0].length | ||
if (length !== 0) return length | ||
return a[0].toUpperCase().localeCompare(b[0].toUpperCase()) | ||
} | ||
// Common transpositions of license identifier acronyms | ||
@@ -45,4 +57,13 @@ var transpositions = [ | ||
['GNU GPL', 'GPL'], | ||
['GNU LGPL', 'LGPL'], | ||
['GNU/GPL', 'GPL'], | ||
['GNU GLP', 'GPL'], | ||
['GNU LESSER GENERAL PUBLIC LICENSE', 'LGPL'], | ||
['GNU Lesser General Public License', 'LGPL'], | ||
['GNU LESSER GENERAL PUBLIC LICENSE', 'LGPL-2.1'], | ||
['GNU Lesser General Public License', 'LGPL-2.1'], | ||
['LESSER GENERAL PUBLIC LICENSE', 'LGPL'], | ||
['Lesser General Public License', 'LGPL'], | ||
['LESSER GENERAL PUBLIC LICENSE', 'LGPL-2.1'], | ||
['Lesser General Public License', 'LGPL-2.1'], | ||
['GNU General Public License', 'GPL'], | ||
@@ -56,4 +77,5 @@ ['Gnu public license', 'GPL'], | ||
['WTH', 'WTF'], | ||
['WTFGPL', 'WTFPL'], | ||
['-License', ''] | ||
] | ||
].sort(sortTranspositions) | ||
@@ -260,3 +282,3 @@ var TRANSPOSED = 0 | ||
['ZLIB', 'Zlib'] | ||
].concat(licensesWithOneVersion) | ||
].concat(licensesWithOneVersion).sort(sortTranspositions) | ||
@@ -263,0 +285,0 @@ var SUBSTRING = 0 |
{ | ||
"name": "spdx-correct", | ||
"description": "correct invalid SPDX expressions", | ||
"version": "3.1.1", | ||
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)", | ||
"contributors": [ | ||
"Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)", | ||
"Christian Zommerfelds <aero_super@yahoo.com>", | ||
"Tal Einat <taleinat@gmail.com>", | ||
"Dan Butvinik <butvinik@outlook.com>" | ||
], | ||
"version": "3.2.0", | ||
"dependencies": { | ||
@@ -17,7 +10,7 @@ "spdx-expression-parse": "^3.0.0", | ||
"devDependencies": { | ||
"defence-cli": "^2.0.1", | ||
"defence-cli": "^3.0.1", | ||
"replace-require-self": "^1.0.0", | ||
"standard": "^11.0.0", | ||
"standard-markdown": "^4.0.2", | ||
"tape": "^4.9.0" | ||
"standard": "^14.3.4", | ||
"standard-markdown": "^6.0.0", | ||
"tape": "^5.0.1" | ||
}, | ||
@@ -24,0 +17,0 @@ "files": [ |
@@ -0,1 +1,3 @@ | ||
## Usage | ||
```javascript | ||
@@ -5,5 +7,5 @@ var correct = require('spdx-correct') | ||
assert.equal(correct('mit'), 'MIT') | ||
assert.strictEqual(correct('mit'), 'MIT') | ||
assert.equal(correct('Apache 2'), 'Apache-2.0') | ||
assert.strictEqual(correct('Apache 2'), 'Apache-2.0') | ||
@@ -16,1 +18,7 @@ assert(correct('No idea what license') === null) | ||
``` | ||
## Contributors | ||
spdx-correct has benefited from the work of several contributors. | ||
See [the GitHub repository](https://github.com/jslicense/spdx-correct.js/graphs/contributors) | ||
for more information. |
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
23412
368
23
1