Naturally Pacifist Marsupials
    Wondering what’s next for npm?Check out our public roadmap! »

    parse-diff
    TypeScript icon, indicating that this package has built-in type declarations

    0.8.1 • Public • Published

    Build Status Total downloads

    NPM

    parse-diff

    Simple unified diff parser for JavaScript

    JavaScript Usage Example

    var parse = require('parse-diff');
    var diff = ''; // input diff string
    var files = parse(diff);
    console.log(files.length); // number of patched files
    files.forEach(function(file) {
    	console.log(file.chunks.length); // number of hunks
    	console.log(file.chunks[0].changes.length) // hunk added/deleted/context lines
    	// each item in changes is a string
    	console.log(file.deletions); // number of deletions in the patch
    	console.log(file.additions); // number of additions in the patch
    });

    Install

    npm i parse-diff

    DownloadsWeekly Downloads

    279,306

    Version

    0.8.1

    License

    MIT

    Unpacked Size

    29.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • avatar