query
On this page

getLicenseFromSpdxIdOr

lib.getLicenseFromSpdxIdOr

Docs pulled from | This Revision | about 1 hour ago


Get the corresponding attribute in lib.licenses from the SPDX ID or fallback to the given default value.

For SPDX IDs, see https://spdx.org/licenses. Note that some SPDX licenses might be missing.

Inputs

licstr
1. SPDX ID string to find a matching license
default
2. Fallback value when a match is not found

Type

getLicenseFromSpdxIdOr :: String -> a -> ({
  deprecated :: Bool;
  free :: Bool;
  fullName :: String;
  redistributable :: Bool;
  shortName :: String;
  spdxId :: String;
  url :: String;
} | a)

Examples

lib.meta.getLicenseFromSpdxIdOr usage example

lib.getLicenseFromSpdxIdOr "MIT" null == lib.licenses.mit
=> true
lib.getLicenseFromSpdxId "mIt" null == lib.licenses.mit
=> true
lib.getLicenseFromSpdxIdOr "MY LICENSE" lib.licenses.free == lib.licenses.free
=> true
lib.getLicenseFromSpdxIdOr "MY LICENSE" null
=> null
lib.getLicenseFromSpdxIdOr "MY LICENSE" (throw "No SPDX ID matches MY LICENSE")
=> error: No SPDX ID matches MY LICENSE
(lib.meta.getLicenseFromSpdxIdOr)

Noogle detected

Aliases