Skip to content

charlesbihis/actionscript-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActionScript Diff Library

An ActionScript 3 implementation of a diff algorithm.

Overview

This library provides an ActionScript 3 implementation of the Myer's diff algorithm. This is a port from the Java implementation of the algorithm as is provided by the google-diff-match-patch project written by Neil Fraser of Google.

This project was first mentioned in my blog post at http://blogs.adobe.com/charles/2011/12/diff-library-for-actionscript.html.

Features

The ActionScript Diff Library supports the following features...

  • Simple API to interact with the diff algorithm
  • Returns diff boundaries of letters which have changed, and letters which haven't
  • Pure AS3 implementation (no Flex SDK required)
  • Documentation!

Dependencies

Reference

Usage

To use the library, simply drop in the SWC (or the source) into your project, along with the appropriate dependencies, and follow the usage below...

var diffs:Array = new Diff().diff(beforeText.text, afterText.text);

The result that you get back is an Array of the different operations that it took to go from the original string to the modified string. You can easily use this to display the differences in whatever way you want.

Demo

Documentation

You can find the full ASDocs for the project here.

Relevant

Author

License

The ActionScript Diff Library is licensed under the Apache License, Version 2.0.