1.0.0 • Published 5 years ago

spdx-to-html v1.0.0

Weekly downloads
431
License
Apache-2.0
Repository
github
Last release
5 years ago
var spdxToHTML = require('spdx-to-html')

Returns null for invalid license expressions:

var assert = require('assert')
assert.deepStrictEqual(
  spdxToHTML('InvalidExpression'),
  null
)

Returns links for standard licenses on spdx.org:

assert.deepStrictEqual(
  spdxToHTML('MIT'),
  '<a href="https://spdx.org/licenses/MIT.html">MIT</a>'
)

For license references:

assert.deepStrictEqual(
  spdxToHTML('LicenseRef-123ABC'),
  'License Reference "LicenseRef-123ABC"'
)

Constructs English disjunctions for multilicensing expressions:

assert.deepStrictEqual(
  spdxToHTML('(MPL-2.0 OR GPL-2.0+)'),
  (
    '<a href="https://spdx.org/licenses/MPL-2.0.html">MPL-2.0</a>' +
    ' or ' +
    '<a href="https://spdx.org/licenses/GPL-2.0.html">GPL-2.0</a> or newer'
  )
)

Describes ranges and exceptions:

assert.deepStrictEqual(
  spdxToHTML('(GPL-2.0+ WITH Bison-exception-2.2)'),
  (
    '<a href="https://spdx.org/licenses/GPL-2.0.html">GPL-2.0</a>' +
    ' or newer' +
    ' with Bison-exception-2.2'
  )
)
1.0.0

5 years ago

0.3.2

7 years ago

0.3.1

8 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago