Skip to content

Commit 7297953

Browse files
author
Julien Caselmann
committed
Add option to skip validation of license names
1 parent 9c30afd commit 7297953

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
var scan = require('./scan')
44
var parse = require('./parse')
55

6-
module.exports = function (source) {
7-
return parse(scan(source))
6+
module.exports = function (source, validateLicenseNames=true) {
7+
return parse(scan(source, validateLicenseNames))
88
}

scan.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var licenses = []
55
.concat(require('spdx-license-ids/deprecated'))
66
var exceptions = require('spdx-exceptions')
77

8-
module.exports = function (source) {
8+
module.exports = function (source, validateLicenseNames=true) {
99
var index = 0
1010

1111
function hasMore () {
@@ -85,14 +85,14 @@ module.exports = function (source) {
8585
var begin = index
8686
var string = idstring()
8787

88-
if (licenses.indexOf(string) !== -1) {
88+
if (exceptions.indexOf(string) !== -1) {
8989
return {
90-
type: 'LICENSE',
90+
type: 'EXCEPTION',
9191
string: string
9292
}
93-
} else if (exceptions.indexOf(string) !== -1) {
93+
} else if (licenses.indexOf(string) !== -1 || !validateLicenseNames) {
9494
return {
95-
type: 'EXCEPTION',
95+
type: 'LICENSE',
9696
string: string
9797
}
9898
}

0 commit comments

Comments
 (0)