Skip to content

An event and Promise based JavaScript parser and render (to HTML) for [unified] diff/patch files.

License

Notifications You must be signed in to change notification settings

unicorn-fail/patchr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

patchr

An event and Promise based JavaScript parser and render (to HTML) for unified diff files.

import fs from 'fs';
import { Patchr } from 'src/js';

// Get a patch from somewhere on the file system.
const string = fs.readFileSync('./some-unified-diff.patch', 'utf8');

// Create a new patchr instance.
const patchr = new Patchr();

patchr
// Parse the data.
.parse(string)
.then((/** @type {Parser} */ parser) => {
  // Parser.render();
})
.then((/** @type {Element} */ element) => {
  element.addClass('my-custom-class');
  console.log(element.toString());
});

About

An event and Promise based JavaScript parser and render (to HTML) for [unified] diff/patch files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published