@types/git-diff-parser
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Installation

npm install --save @types/git-diff-parser

Summary

This package contains type definitions for git-diff-parser (https://github.com/spookd/git-diff-parser).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/git-diff-parser.

index.d.ts

/// <reference types='node' />

declare function GitDiffParser(input: string | Buffer): GitDiffParser.Result;
declare namespace GitDiffParser {
    /** Represents prefix in `git diff` output: '+', '-', or space */
    type LineType = "deleted" | "added" | "normal";

    interface Line {
        type: LineType;

        /** Has line break. Always false for added failes */
        break: boolean;

        /** Content of removed or added string */
        text: string;

        /** The main line number */
        ln1: number;

        /** New line number (for type normal) */
        ln2?: number | undefined;
    }

    interface File {
        deleted: boolean;
        added: boolean;
        renamed: boolean;
        binary: boolean;
        lines: Line[];
        index?: string[] | undefined;
        oldName?: string | undefined;
        name: string;
    }

    interface Commit {
        files: File[];
    }

    interface DetailedCommit extends Commit {
        message?: string | undefined;
        sha?: string | undefined;
        date?: Date | undefined;
        author?: string | undefined;
        email?: string | undefined;
    }

    interface Result {
        detailed: boolean;
        commits: Commit[];
    }

    interface DryResult extends Result {
        detailed: false;
    }

    interface DetailedResult extends Result {
        detailed: true;
        commits: DetailedCommit[];
    }
}

export = GitDiffParser;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Alexey Yaroshevich.

Dependents (4)

Package Sidebar

Install

npm i @types/git-diff-parser

Weekly Downloads

3,410

Version

1.0.4

License

MIT

Unpacked Size

5.56 kB

Total Files

5

Last publish

Collaborators

  • types