Package Exports
- gitdiff-parser
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gitdiff-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gitdiff-parser
A fast and reliable git diff parser.
Install
npm install gitdiff-parserUsage
import gitDiffParser from 'gitdiff-parser';
gitDiffParser.parse(gitDiffText);gitDiffText should be a diff output by git diff command.
API
export interface Change {
content: string;
type: 'insert' | 'delete' | 'normal';
isInsert?: boolean;
isDelete?: boolean;
isNormal?: boolean;
lineNumber?: number;
oldLineNumber?: number;
newLineNumber?: number;
}
export interface Hunk {
content: string;
oldStart: number;
newStart: number;
oldLines: number;
newLines: number;
changes: Change[];
}
export interface File {
hunks: Hunk[];
oldEndingNewLine: boolean;
newEndingNewLine: boolean;
oldMode: string;
newMode: string;
similarity?: number;
oldRevision: string;
newRevision: string;
oldPath: string;
newPath: string;
isBinary?: boolean;
type: 'add' | 'delete' | 'modify';
}
export default {
parse(source: string): File[];
};