terminal-diff

1.0.0 • Public • Published

terminal-diff

A small library for handling the diffing that is useful for rendering applications on a terminal screen

var TerminalDiff = require('terminal-diff');

var tdiff = new TerminalDiff();

tdiff.on('reset',function(text) { var lines = text.split('\n');

//Clear the screen for a redraw.
screen.clear();

//Write in line
lines.forEach(function(content,lineIndex) {

	//Write the line to the screen
	screen.write({
		line: lineIndex,
		content: content
	});
});

});

tdiff.on('update', function(diff) { diff.forEach(screen.write); });

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    2

Package Sidebar

Install

npm i terminal-diff

Weekly Downloads

2

Version

1.0.0

License

BSD

Last publish

Collaborators

  • itsjoesullivan