Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/License

primitives/License

Type Aliases

LicenseType

LicenseType = string & object
Defined in: src/primitives/License/LicenseType.ts:14 Branded License type - represents SPDX license identifier Used in smart contract metadata for license identification Common values: “MIT”, “Apache-2.0”, “GPL-3.0”, “BSD-3-Clause”, “UNLICENSED”

Type Declaration

[brand]
readonly [brand]: "License"

Example

const license: LicenseType = "MIT";

Variables

COMMON_LICENSES

const COMMON_LICENSES: string[]
Defined in: src/primitives/License/constants.js:5 Common SPDX license identifiers

See

https://spdx.org/licenses/

License

const License: object
Defined in: src/primitives/License/index.ts:33

Type Declaration

COMMON_LICENSES
COMMON_LICENSES: string[]
Common SPDX license identifiers
See
https://spdx.org/licenses/
from()
from: (value) => LicenseType
Create License from SPDX identifier string
Parameters
value
string SPDX license identifier (e.g., “MIT”, “Apache-2.0”)
Returns
LicenseType License
Example
const license = License.from("MIT");
const unlicensed = License.from("UNLICENSED");
isOSI()
isOSI: (license) => boolean
Parameters
license
string
Returns
boolean
OSI_APPROVED_LICENSES
OSI_APPROVED_LICENSES: string[]
OSI-approved open source licenses
See
https://opensource.org/licenses
toString()
toString: (license) => string
Parameters
license
string
Returns
string

OSI_APPROVED_LICENSES

const OSI_APPROVED_LICENSES: string[]
Defined in: src/primitives/License/constants.js:22 OSI-approved open source licenses

See

https://opensource.org/licenses

Functions

_isOSI()

_isOSI(license): boolean
Defined in: src/primitives/License/isOSI.js:18 Check if license is OSI-approved

Parameters

license
LicenseType License to check

Returns

boolean True if OSI-approved

Example

const isOSI = License.isOSI("MIT");
console.log(isOSI); // true

const isOSI2 = License.isOSI("UNLICENSED");
console.log(isOSI2); // false

_toString()

_toString(license): string
Defined in: src/primitives/License/toString.js:14 Convert License to string

Parameters

license
LicenseType License to convert

Returns

string String representation

Example

const str = License.toString(license);
console.log(str); // "MIT"

from()

from(value): LicenseType
Defined in: src/primitives/License/from.js:13 Create License from SPDX identifier string

Parameters

value
string SPDX license identifier (e.g., “MIT”, “Apache-2.0”)

Returns

LicenseType License

Example

const license = License.from("MIT");
const unlicensed = License.from("UNLICENSED");

isOSI()

isOSI(license): boolean
Defined in: src/primitives/License/index.ts:20

Parameters

license
string

Returns

boolean

toString()

toString(license): string
Defined in: src/primitives/License/index.ts:25

Parameters

license
string

Returns

string