licenseId method

String licenseId(
  1. String text
)

Get the license identifier of a package license. Returns the SPDX license id as defined in the SPDX Specification Appendix V or NOASSERTION if the license cannot be determined.

Implementation

String licenseId(String text) {
  var output = SbomSpdxConstants.noAssertion;
  final details =
      licenses.keys.firstWhere((e) => text.contains(e), orElse: () => '');
  if (details.isNotEmpty) {
    output = licenses[details]!.licenseId;
  }

  return output;
}