Skip to content

Commit

Permalink
Add option to skip validation of license names
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Caselmann committed Sep 10, 2019
1 parent 9c30afd commit 7297953
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
var scan = require('./scan')
var parse = require('./parse')

module.exports = function (source) {
return parse(scan(source))
module.exports = function (source, validateLicenseNames=true) {
return parse(scan(source, validateLicenseNames))
}
10 changes: 5 additions & 5 deletions scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var licenses = []
.concat(require('spdx-license-ids/deprecated'))
var exceptions = require('spdx-exceptions')

module.exports = function (source) {
module.exports = function (source, validateLicenseNames=true) {
var index = 0

function hasMore () {
Expand Down Expand Up @@ -85,14 +85,14 @@ module.exports = function (source) {
var begin = index
var string = idstring()

if (licenses.indexOf(string) !== -1) {
if (exceptions.indexOf(string) !== -1) {
return {
type: 'LICENSE',
type: 'EXCEPTION',
string: string
}
} else if (exceptions.indexOf(string) !== -1) {
} else if (licenses.indexOf(string) !== -1 || !validateLicenseNames) {
return {
type: 'EXCEPTION',
type: 'LICENSE',
string: string
}
}
Expand Down

0 comments on commit 7297953

Please sign in to comment.