1 | // Type definitions for spdx-expression-parse 3.0
|
2 | // Project: https://github.com/jslicense/spdx-expression-parse.js#readme
|
3 | // Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5 |
|
6 | /**
|
7 | * This package parses SPDX license expression strings describing license terms, like `package.json` license strings,
|
8 | * into consistently structured ECMAScript object
|
9 | */
|
10 | declare function parse(source: string): parse.Info;
|
11 |
|
12 | declare namespace parse {
|
13 | type Info = LicenseInfo | ConjunctionInfo;
|
14 |
|
15 | interface LicenseInfo {
|
16 | license: string;
|
17 | plus?: true | undefined;
|
18 | }
|
19 |
|
20 | interface ConjunctionInfo {
|
21 | conjunction: 'and' | 'or';
|
22 | left: LicenseInfo | ConjunctionInfo;
|
23 | right: LicenseInfo | ConjunctionInfo;
|
24 | }
|
25 |
|
26 | interface Token {
|
27 | type: 'OPERATOR' | 'LICENSE' | 'DOCUMENTREF' | 'LICENSEREF' | 'EXCEPTION';
|
28 | string: string;
|
29 | }
|
30 | }
|
31 |
|
32 | export = parse;
|