File: index.d.ts

package info (click to toggle)
node-spdx-expression-parse 3.0.1%2B~3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 160 kB
  • sloc: javascript: 369; makefile: 2
file content (32 lines) | stat: -rwxr-xr-x 979 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Type definitions for spdx-expression-parse 3.0
// Project: https://github.com/jslicense/spdx-expression-parse.js#readme
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/**
 * This package parses SPDX license expression strings describing license terms, like `package.json` license strings,
 * into consistently structured ECMAScript object
 */
declare function parse(source: string): parse.Info;

declare namespace parse {
    type Info = LicenseInfo | ConjuctionInfo;

    interface LicenseInfo {
        license: string;
        plus?: true | undefined;
    }

    interface ConjuctionInfo {
        conjunction: 'and' | 'or';
        left: LicenseInfo | ConjuctionInfo;
        right: LicenseInfo | ConjuctionInfo;
    }

    interface Token {
        type: 'OPERATOR' | 'LICENSE' | 'DOCUMENTREF' | 'LICENSEREF' | 'EXCEPTION';
        string: string;
    }
}

export = parse;