Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typically i'd expect absence and false to be the same for boolean options; this should probably be inverted so it can default to false?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely right, I will change this.

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