fast-diff

WebJar for fast-diff

License

License

GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

fast-diff
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

fast-diff
WebJar for fast-diff
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jhchen/fast-diff

Download fast-diff

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/fast-diff/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>fast-diff</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/fast-diff/
implementation 'org.webjars.npm:fast-diff:1.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/fast-diff/
implementation ("org.webjars.npm:fast-diff:1.2.0")
'org.webjars.npm:fast-diff:jar:1.2.0'
<dependency org="org.webjars.npm" name="fast-diff" rev="1.2.0">
  <artifact name="fast-diff" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='fast-diff', version='1.2.0')
)
libraryDependencies += "org.webjars.npm" % "fast-diff" % "1.2.0"
[org.webjars.npm/fast-diff "1.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Fast Diff Build Status

This is a simplified import of the excellent diff-match-patch library by Neil Fraser into the Node.js environment. The match and patch parts are removed, as well as all the extra diff options. What remains is incredibly fast diffing between two strings.

The diff function is an implementation of "An O(ND) Difference Algorithm and its Variations" (Myers, 1986) with the suggested divide and conquer strategy along with several optimizations Neil added.

var diff = require('fast-diff');

var good = 'Good dog';
var bad = 'Bad dog';

var result = diff(good, bad);
// [[-1, "Goo"], [1, "Ba"], [0, "d dog"]]

// Respect suggested edit location (cursor position), added in v1.1
diff('aaa', 'aaaa', 1)
// [[0, "a"], [1, "a"], [0, "aa"]]

// For convenience
diff.INSERT === 1;
diff.EQUAL === 0;
diff.DELETE === -1;

Versions

Version
1.2.0
1.1.2
1.1.1
1.0.1