UNPKG

715 BTypeScriptView Raw
1/**
2 * This package parses SPDX license expression strings describing license terms, like `package.json` license strings,
3 * into consistently structured ECMAScript object
4 */
5declare function parse(source: string): parse.Info;
6
7declare namespace parse {
8 type Info = LicenseInfo | ConjunctionInfo;
9
10 interface LicenseInfo {
11 license: string;
12 plus?: true | undefined;
13 }
14
15 interface ConjunctionInfo {
16 conjunction: "and" | "or";
17 left: LicenseInfo | ConjunctionInfo;
18 right: LicenseInfo | ConjunctionInfo;
19 }
20
21 interface Token {
22 type: "OPERATOR" | "LICENSE" | "DOCUMENTREF" | "LICENSEREF" | "EXCEPTION";
23 string: string;
24 }
25}
26
27export = parse;