jslicense/spdx-correct.js

correct invalid SPDX identifiers

JavaScript

35

117 commits

updated Apr 15, 2024

See the code

README

Usage

var correct = require('spdx-correct')
var assert = require('assert')

assert.strictEqual(correct('mit'), 'MIT')

assert.strictEqual(correct('Apache 2'), 'Apache-2.0')

assert(correct('No idea what license') === null)

// disable upgrade option
assert(correct('GPL-3.0'), 'GPL-3.0-or-later')
assert(correct('GPL-3.0', { upgrade: false }), 'GPL-3.0')

Performance Note

This package load and processes the spdx-license-ids package, as well as a few other large arrays of strings, into global variables. That can take a few milliseconds.

If you'd prefer to postpone that processing until your program actually invokes the exported function, consider using require() or dynamic import() to load the package just before you invoke it.

Special thanks to Vinicius Lourenço (@H4ad) for investigating load times.

Contributors

spdx-correct has benefited from the work of several contributors. See the GitHub repository for more information.

jslicense/spdx-correct.js

correct invalid SPDX identifiers

JavaScript

35

117 commits

updated Apr 15, 2024

See the code

README

Usage

var correct = require('spdx-correct')
var assert = require('assert')

assert.strictEqual(correct('mit'), 'MIT')

assert.strictEqual(correct('Apache 2'), 'Apache-2.0')

assert(correct('No idea what license') === null)

// disable upgrade option
assert(correct('GPL-3.0'), 'GPL-3.0-or-later')
assert(correct('GPL-3.0', { upgrade: false }), 'GPL-3.0')

Performance Note

This package load and processes the spdx-license-ids package, as well as a few other large arrays of strings, into global variables. That can take a few milliseconds.

If you'd prefer to postpone that processing until your program actually invokes the exported function, consider using require() or dynamic import() to load the package just before you invoke it.

Special thanks to Vinicius Lourenço (@H4ad) for investigating load times.

Contributors

spdx-correct has benefited from the work of several contributors. See the GitHub repository for more information.

Project health

Overall

3.0/10

Maintained

0/10

Code review

2/10
OpenSSF Scorecard

Latest release

3.2.0 · Mar 7, 2023

Releases this year

0