UNPKG

979 BTypeScriptView Raw
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 */
10declare function parse(source: string): parse.Info;
11
12declare namespace parse {
13 type Info = LicenseInfo | ConjuctionInfo;
14
15 interface LicenseInfo {
16 license: string;
17 plus?: true | undefined;
18 }
19
20 interface ConjuctionInfo {
21 conjunction: 'and' | 'or';
22 left: LicenseInfo | ConjuctionInfo;
23 right: LicenseInfo | ConjuctionInfo;
24 }
25
26 interface Token {
27 type: 'OPERATOR' | 'LICENSE' | 'DOCUMENTREF' | 'LICENSEREF' | 'EXCEPTION';
28 string: string;
29 }
30}
31
32export = parse;